Opened a trade that should not have opened!!
Opened a trade that should not have opened!!
28 Apr 2015, 10:08
Hi. I have a robot trading live. Yesterday, and for the first time ever the robot opened a trade while the same type of trade was already open. THIS IS NOT SUPPOSED TO HAPPEN!!
If I run a back test the wrong trade is not even picked up. Why will this happen?
Need urgent help pls!
Replies
WhiteSage
28 Apr 2015, 22:25
Without seeing the code its hard to say, I would check your code to be doubly sure you are searching for the right trade labels and that the instantiating code for the trade has the right label (do you have many different trade scenarios?)
The fact it didn't refire in backtest is curious but not unforeseen.
Some of the differences are:
Backtests with OnTick are inaccurate unless you are using tick data.
Backtests only start with a fraction of the available bars a chart has, this may effect long MA's or any indicators that use Min and Max values or accumulate.
Backtest chart grow (how large I do not actually know!) with each tick. I assume forward tests do also.
@WhiteSage
davidp13
28 Apr 2015, 22:54
RE:
WhiteSage said:
Without seeing the code its hard to say, I would check your code to be doubly sure you are searching for the right trade labels and that the instantiating code for the trade has the right label (do you have many different trade scenarios?)
The fact it didn't refire in backtest is curious but not unforeseen.
Some of the differences are:
Backtests with OnTick are inaccurate unless you are using tick data.
Backtests only start with a fraction of the available bars a chart has, this may effect long MA's or any indicators that use Min and Max values or accumulate.
Backtest chart grow (how large I do not actually know!) with each tick. I assume forward tests do also.
Thanks for trying to respond. Yes I do have many scenarios, but the label use is correct and the amount of scenarios are countered by it. Im not for one minute saying my code is clean and efficient, but still this should not happen.
Where is the support people of this platform? Please respond!
@davidp13
Spotware
19 Jun 2015, 17:26
Dear Traders,
We do not provide coding assistance services. We more than glad to assist you with specific questions about cAlgo.API. You also can contact one of our Partners or post a job in Development Jobs section for further coding assistance.
@Spotware
davidp13
28 Apr 2015, 16:48 ( Updated at: 21 Dec 2023, 09:20 )
Anyone able to answer this for me:
here are extracts of the code:
private const string label3 = "InTrendLong";
var longInTrendPosition = Positions.Find(label3, Symbol, TradeType.Buy);
if (previousSlowMa > previousFastMa && longMaDiffB < LongMaDiffBuy && currentSlowMa <= currentFastMa && valueClose > previousLongMaOpenInTrendBuy && longInTrendPosition == null)
{
ExecuteMarketOrder(TradeType.Buy, Symbol, Volume, label3, StopLossInTrendBuy, TakeProfitInTrendBuy);
If you look at the attached image you can see there were two open positions with the same label - THIS SHOULD NOT HAPPEN due to longInTrendPosition == null
SO WHAT IS GOING ON PLS?
@davidp13