market order is ignored in my algo
market order is ignored in my algo
04 Mar 2021, 16:50
Hi,
I made new simple bot, but for some reason marker order is totally ignored, No order, no error message, and it continues further without any problem.
I copied marker order from other working bot:
ExecuteMarketOrder(TradeType.Buy, SymbolName, 10);
Any idea why this can be happening?
Replies
marian.kosa
04 Mar 2021, 18:27
RE:
Hope this helps.
using System.Linq;
using cAlgo.API;
using System.IO;
using System.Collections;
using System.Collections.Generic;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
using cAlgo.Indicators;
namespace cAlgo
{
[Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.FileSystem)]
public class MACD : Robot
{
protected override void OnStart()
{
_MACD = Indicators.MacdCrossOver(26, 12, 9);
}
protected override void OnBar()
{
if (Positions.Count() == 0)
{
if (_MACD.MACD.IsRising())
{
ExecuteMarketOrder(TradeType.Buy, SymbolName, 100);
Print("1");
}
else if (_MACD.MACD.IsFalling())
{
ExecuteMarketOrder(TradeType.Sell, SymbolName, 100, "sell");
Print("2");
}
Print("3");
}
}
}
}
PanagiotisCharalampous said:
Hi marian.kosa,
To assist you further, please provide us with the complete cBot code and exact steps to reproduce this behavior.
Best Regards,
Panagiotis
@marian.kosa
PanagiotisCharalampous
05 Mar 2021, 08:27
Hi marian.kosa,
On which symbol do you run this? Is the volume appropriate? Do you get any messages in the log?
Best Regards,
Panagiotis
@PanagiotisCharalampous
marian.kosa
05 Mar 2021, 08:52
RE:
I tried it on 2 random forex pairs (eurUsd, UsdJpy), I am backtesting it on my demo account, volume should not be a problem. In Log i see only those print() numbers. 313132313232 etc... nothing about orders.
PanagiotisCharalampous said:
Hi marian.kosa,
On which symbol do you run this? Is the volume appropriate? Do you get any messages in the log?
Best Regards,
Panagiotis
@marian.kosa
PanagiotisCharalampous
05 Mar 2021, 08:59
( Updated at: 21 Dec 2023, 09:22 )
Hi marian.kosa,
If you try this volume on EURUSD, you will get the below errors in the log
The volume is the reason your orders are not executed.
Best Regards,
Panagiotis
@PanagiotisCharalampous
marian.kosa
05 Mar 2021, 09:13
RE: RE:
Ok. the volume needs to be at least 1000, not 100. I missunderstood tooltips there. Wonder why i did not get any error message during backtesting...
marian.kosa said:
I tried it on 2 random forex pairs (eurUsd, UsdJpy), I am backtesting it on my demo account, volume should not be a problem. In Log i see only those print() numbers. 313132313232 etc... nothing about orders.
PanagiotisCharalampous said:
Hi marian.kosa,
On which symbol do you run this? Is the volume appropriate? Do you get any messages in the log?
Best Regards,
Panagiotis
@marian.kosa
PanagiotisCharalampous
05 Mar 2021, 10:25
Hi marian.kosa,
You can see the error message in the log, as shown above.
Best Regards,
Panagiotis
@PanagiotisCharalampous
marian.kosa
05 Mar 2021, 11:08
( Updated at: 21 Dec 2023, 09:22 )
RE:
Aha, I only saw this. That is why i was so confused. I did not know that i dont see everything by default in log...
Thanks for help and sorry for my ignorance :)
Regards,
Marian
PanagiotisCharalampous said:
Hi marian.kosa,
You can see the error message in the log, as shown above.
Best Regards,
Panagiotis
@marian.kosa
PanagiotisCharalampous
04 Mar 2021, 16:53
Hi marian.kosa,
To assist you further, please provide us with the complete cBot code and exact steps to reproduce this behavior.
Best Regards,
Panagiotis
Join us on Telegram
@PanagiotisCharalampous