Topics
Replies
PanagiotisCharalampous
22 Nov 2021, 10:33
Hi there,
You need to reach out to your broker regarding this issue.
Best Regards,
Panagiotis
Join us on Telegram and Facebook
@PanagiotisCharalampous
PanagiotisCharalampous
22 Nov 2021, 08:32
Hi lisardy11,
ADX is a part of the Directional Movement System indicator.
Best Regards,
Panagiotis
Join us on Telegram and Facebook
@PanagiotisCharalampous
PanagiotisCharalampous
22 Nov 2021, 08:29
Hi crobbeandersson,
You should post your suggestions in the Suggestions section.
Best Regards,
Panagiotis
Join us on Telegram and Facebook
@PanagiotisCharalampous
PanagiotisCharalampous
19 Nov 2021, 15:45
( Updated at: 21 Dec 2023, 09:22 )
Hi bowen.guo.kaust,
In the exact same way as simple moving average. Quoting the formula again
The mean value is the average and n is the number of periods.
Best Regards,
Panagiotis
Join us on Telegram and Facebook
@PanagiotisCharalampous
PanagiotisCharalampous
19 Nov 2021, 14:45
( Updated at: 21 Dec 2023, 09:22 )
Hi haohan51,
Send it like this
Also make sure there are no indicators/cBots running in cTrader Automate
Best Regards,
Panagiotis
Join us on Telegram and Facebook
@PanagiotisCharalampous
PanagiotisCharalampous
19 Nov 2021, 12:21
Hi haohan51,
You can send us some troubleshooting info when this happens (Ctrl+Alt+Shift+T). However I am 99% sure this is happening because of your cBot.
Best Regards,
Panagiotis
Join us on Telegram and Facebook
@PanagiotisCharalampous
PanagiotisCharalampous
18 Nov 2021, 21:26
Hi there,
That's normal. Read here. You need to apply rounding.
Best Regards,
Panagiotis
Join us on Telegram and Facebook
@PanagiotisCharalampous
PanagiotisCharalampous
18 Nov 2021, 15:21
Hi MATRIXTRADER,
See your modified strategy, using BarOpened instead, below
using System;
using System.Linq;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
using cAlgo.Indicators;
using System.Runtime.InteropServices;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using System.Collections;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.IO;
using System.Reflection;
using System.Threading;
using System.Diagnostics;
using Microsoft.Win32;
using cAlgo.API.Requests;
using System.Text;
namespace cAlgo
{
[Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.FullAccess)]
public class MultyTraDinGPro : Robot
{
[Parameter("Use CHOOSE 1", DefaultValue = true)]
public bool useCHOOSE1 { get; set; }
[Parameter("CHOOSE SYMBOL 1", DefaultValue = "GER40")]
public string Symbol1 { get; set; }
[Parameter("Another Timeframe", DefaultValue = "HOUR")]
public TimeFrame AnotherTimeFrame1 { get; set; }
[Parameter("Label 1", DefaultValue = "dax")]
public string RobotID1 { get; set; }
[Parameter("Volume", DefaultValue = 0.6, MinValue = 0)]
public double Volume1 { get; set; }
[Parameter("SL ", DefaultValue = 60)]
public double SL1 { get; set; }
[Parameter("TP ", DefaultValue = 10)]
public double TP1 { get; set; }
[Parameter("MA_period", DefaultValue = 24)]
public int MA_period1 { get; set; }
[Parameter("MAType", DefaultValue = MovingAverageType.VIDYA)]
public MovingAverageType MAType1 { get; set; }
[Parameter("--------MACD-----------------", DefaultValue = "MACD")]
public string Separator6 { get; set; }
[Parameter("MACD LongCycle", DefaultValue = 30, MinValue = 1)]
public int LongCycle1 { get; set; }
[Parameter("MACD ShortCycle", DefaultValue = 2, MinValue = 1)]
public int ShortCycle1 { get; set; }
[Parameter("MACD Period", DefaultValue = 20, MinValue = 1)]
public int MACDPeriod1 { get; set; }
[Parameter("__________________________", DefaultValue = "___________")]
public string Separator1 { get; set; }
/////////////////////////////////////////////////////////////////////////////////////////////////////////
[Parameter("Use CHOOSE 2", DefaultValue = true)]
public bool useCHOOSE2 { get; set; }
[Parameter("CHOOSE SYMBOL 2", DefaultValue = "GBPUSD")]
public string Symbol2 { get; set; }
[Parameter("Another Timeframe", DefaultValue = "HOUR")]
public TimeFrame AnotherTimeFrame2 { get; set; }
[Parameter("Label 1", DefaultValue = "gbp")]
public string RobotID2 { get; set; }
[Parameter("Volume", DefaultValue = 5000, MinValue = 0)]
public double Volume2 { get; set; }
[Parameter("SL ", DefaultValue = 110)]
public double SL2 { get; set; }
[Parameter("TP ", DefaultValue = 20)]
public double TP2 { get; set; }
[Parameter("MA_period", DefaultValue = 100)]
public int MA_period2 { get; set; }
[Parameter("MAType", DefaultValue = MovingAverageType.Simple)]
public MovingAverageType MAType2 { get; set; }
[Parameter("MACD LongCycle", DefaultValue = 21, MinValue = 1)]
public int LongCycle2 { get; set; }
[Parameter("MACD ShortCycle", DefaultValue = 12, MinValue = 1)]
public int ShortCycle2 { get; set; }
[Parameter("MACD Period", DefaultValue = 9, MinValue = 1)]
public int MACDPeriod2 { get; set; }
[Parameter("__________________________", DefaultValue = "___________")]
public string Separator2 { get; set; }
//////////////////////////////////////////////////////////////////////////////////////////////////////
[Parameter("Use CHOOSE 3", DefaultValue = true)]
public bool useCHOOSE3 { get; set; }
[Parameter("CHOOSE SYMBOL 3", DefaultValue = "XAUUSD")]
public string Symbol3 { get; set; }
[Parameter("Another Timeframe", DefaultValue = "HOUR")]
public TimeFrame AnotherTimeFrame3 { get; set; }
[Parameter("Label 3", DefaultValue = "gold")]
public string RobotID3 { get; set; }
[Parameter("Volume", DefaultValue = 3, MinValue = 0)]
public double Volume3 { get; set; }
[Parameter("SL ", DefaultValue = 120)]
public double SL3 { get; set; }
[Parameter("TP ", DefaultValue = 15)]
public double TP3 { get; set; }
[Parameter("MA_period", DefaultValue = 200)]
public int MA_period3 { get; set; }
[Parameter("MAType", DefaultValue = MovingAverageType.Exponential)]
public MovingAverageType MAType3 { get; set; }
[Parameter("MACD LongCycle", DefaultValue = 32, MinValue = 1)]
public int LongCycle3 { get; set; }
[Parameter("MACD ShortCycle", DefaultValue = 14, MinValue = 1)]
public int ShortCycle3 { get; set; }
[Parameter("MACD Period", DefaultValue = 30, MinValue = 1)]
public int MACDPeriod3 { get; set; }
[Parameter("__________________________", DefaultValue = "___________")]
public string Separator20E { get; set; }
private MovingAverage MA1;
private MacdHistogram _macd1;
private MovingAverage MA2;
private MacdHistogram _macd2;
private MovingAverage MA3;
private MacdHistogram _macd3;
private Symbol _symbol1;
private Symbol _symbol2;
private Symbol _symbol3;
/////////////////////////////////////////////////////////////////////////////////////////////////////////
private void InitializeSeries(string symbolCode)
{
_symbol1 = Symbols.GetSymbol(Symbol1);
_symbol2 = Symbols.GetSymbol(Symbol2);
_symbol3 = Symbols.GetSymbol(Symbol3);
}
protected override void OnStart()
{
InitializeSeries(Symbol1);
InitializeSeries(Symbol2);
InitializeSeries(Symbol3);
{
var bars = MarketData.GetBars(AnotherTimeFrame1, Symbol1);
bars.BarOpened += Bars_BarOpened;
MA1 = Indicators.MovingAverage(bars.ClosePrices, MA_period1, MAType1);
_macd1 = Indicators.MacdHistogram(bars.ClosePrices, LongCycle1, ShortCycle1, MACDPeriod1);
var bars2 = MarketData.GetBars(AnotherTimeFrame2, Symbol2);
bars.BarOpened += Bars_BarOpened1;
MA2 = Indicators.MovingAverage(bars2.ClosePrices, MA_period2, MAType2);
_macd2 = Indicators.MacdHistogram(bars2.ClosePrices, LongCycle2, ShortCycle2, MACDPeriod2);
var bars3 = MarketData.GetBars(AnotherTimeFrame3, Symbol3);
bars3.BarOpened += Bars3_BarOpened;
MA3 = Indicators.MovingAverage(bars3.ClosePrices, MA_period3, MAType3);
_macd3 = Indicators.MacdHistogram(bars3.ClosePrices, LongCycle3, ShortCycle3, MACDPeriod3);
}
}
private void Bars3_BarOpened(BarOpenedEventArgs obj)
{
ManagePositions3();
}
private void Bars_BarOpened1(BarOpenedEventArgs obj)
{
ManagePositions2();
}
private void Bars_BarOpened(BarOpenedEventArgs obj)
{
ManagePositions1();
}
private void ManagePositions1()
{
if (useCHOOSE1 == true)
{
var cBotPositions = Positions.FindAll(RobotID1);
if (cBotPositions.Length >= 1)
return;
{
if (MA1.Result.IsRising() && _macd1.Signal.IsRising())
{
ExecuteMarketOrder(TradeType.Buy, _symbol1, Volume1, RobotID1, SL1, TP1);
{
if (MA1.Result.IsFalling() && _macd1.Signal.IsFalling())
{
ExecuteMarketOrder(TradeType.Sell, Symbol1, Volume1, RobotID1, SL1, TP1);
}
}
}
}
}
}
//////////////////////////////////////////////////////////////////
private void ManagePositions2()
{
if (useCHOOSE2)
{
var cBotPositions = Positions.FindAll(RobotID2);
if (cBotPositions.Length >= 1)
return;
{
if (MA2.Result.IsRising() && _macd2.Signal.IsRising())
{
ExecuteMarketOrder(TradeType.Buy, _symbol2, Volume2, RobotID2, SL2, TP2);
{
if (MA2.Result.IsFalling() && _macd2.Signal.IsFalling())
{
ExecuteMarketOrder(TradeType.Sell, _symbol2, Volume2, RobotID2, SL2, TP2);
}
}
}
}
}
}
//////////////////////////////////////////////////////////////////
private void ManagePositions3()
{
//
if (useCHOOSE3 == true)
{
var cBotPositions = Positions.FindAll(RobotID3);
if (cBotPositions.Length >= 1)
return;
{
if (MA3.Result.IsRising() && _macd3.Signal.IsRising())
{
ExecuteMarketOrder(TradeType.Buy, _symbol3, Volume3, RobotID3, SL3, TP3);
{
if (MA3.Result.IsFalling() && _macd3.Signal.IsFalling())
{
ExecuteMarketOrder(TradeType.Sell, _symbol3, Volume3, RobotID3, SL3, TP3);
}
}
}
}
}
}
}
}
Best Regards,
Panagiotis
Join us on Telegram and Facebook
@PanagiotisCharalampous
PanagiotisCharalampous
18 Nov 2021, 11:39
Hi there,
Please explain what do you thing s wrong here. The results seem correct to me.
Best Regards,
Panagiotis
Join us on Telegram and Facebook
@PanagiotisCharalampous
PanagiotisCharalampous
18 Nov 2021, 09:02
Hi haohan51,
Is this likely the underlying issue?
It's a probable cause
If so, are you able to make any suggestions?
Either get a VPS with higher specs or optimize your code
The code at the moment uses the "Async" method to operate, such as "ModifyPendingOrderAsync" and "ModifyPositionAsync". Does this add extra workload onto the CPU because it's trying to do everything in parallel? Would using non-Async method reduce the CPU load?
It could decrease the CPU load but it will make execution slower. If your trading decisions are time critical, then opt for a VPS with more cores.
Best Regards,
Panagiotis
Join us on Telegram and Facebook
@PanagiotisCharalampous
PanagiotisCharalampous
17 Nov 2021, 08:54
Hi blockchainTrader1,
This can also happen earlier. It depends on your broker's stop out level.
Best Regards,
Panagiotis
Join us on Telegram and Facebook
@PanagiotisCharalampous
PanagiotisCharalampous
17 Nov 2021, 08:01
Hi MATRIXTRADER,
One of the improvements you can make to the code is to execute the logic of the cBot on each symbol's BarOpened event. OnBar is executed differently for each symbol and this can cause discrepancies to the results.
Best Regards,
Panagiotis
Join us on Telegram and Facebook
@PanagiotisCharalampous
PanagiotisCharalampous
17 Nov 2021, 07:56
Hi haohan51,
There is no gerenal issue with our connectivity at the moment so probably the issue is on your side. Some things you can check.
- Check your proxy latency. Try restarting cTrader so that it can connect to the best available proxy.
- Confirm that your VPS can execute your cBots efficiently. If the cBots consume much of the resources of the VPS, disconnections might happen.
- Try running the cBot on a different machine, maybe your own PC, and check if you can reproduce the problem.
Best Regards,
Panagiotis
Join us on Telegram and Facebook
@PanagiotisCharalampous
PanagiotisCharalampous
16 Nov 2021, 10:15
Hi blockchainTrader1,
You can use enums for this purpose.
Best Regards,
Panagiotis
Join us on Telegram and Facebook
@PanagiotisCharalampous
PanagiotisCharalampous
16 Nov 2021, 10:14
Hi blockchainTrader1,
If your account is stopped out, then you are obviously using leverage. You are opening positions with a value higher than your account's balance/ The account's leverage does not matter and has no effect to the size of positions you are opening. If you don't want to use your account's leverage, just don't use it and open positions with a value that does not exceed your account's equity.
Best Regards,
Panagiotis
Join us on Telegram and Facebook
@PanagiotisCharalampous
PanagiotisCharalampous
16 Nov 2021, 08:19
Hi vitorsilvabr.f,
Your post is not very clear to me. Do you mind elaborating a bit?
Best Regards,
Panagiotis
Join us on Telegram and Facebook
@PanagiotisCharalampous
PanagiotisCharalampous
16 Nov 2021, 08:13
Hi blockchainTrader1,
You can do this with any leverage account. Your account's leverage just defimes the upper limit of volume you can use. But does not restrict you from trading lower volumes than that. If for example your account has a balance of 1000 and you want to buy stocks worth of 1000 valued at 200 each, just buy 5 stocks.
Best Regards,
Panagiotis
Join us on Telegram and Facebook
@PanagiotisCharalampous
PanagiotisCharalampous
16 Nov 2021, 08:09
Hi blockchainTrader1,
Thanks for your post. However it is not clear to me what the question is. Can you be more specific?
Best Regards,
Panagiotis
Join us on Telegram and Facebook
@PanagiotisCharalampous
PanagiotisCharalampous
15 Nov 2021, 14:41
Hi there,
Can you please provide us with examples of these "wrong weird math calculation results"?
Best Regards,
Panagiotis
Join us on Telegram and Facebook
@PanagiotisCharalampous
PanagiotisCharalampous
24 Nov 2021, 15:06
Hi phill.beaney,
The thread I posted advises to update your Inter Iris drivers. Did you try that?
Best Regards,
Panagiotis
Join us on Telegram and Facebook
@PanagiotisCharalampous