I need some assistance with Syntax/Thinking behind the code
int b,bLimit=30; double cls, stop; bool fillMe=false; for(int a=OrdersHistoryTotal()-1;a>=0;a++){ b=iBarShift(NULL,0,OrderCloseTime()); if(b>bLimit)continue;//---bLimit is the x no. of the bars for all close trades to be considered cls=OrderClosePrice(); stop=OrderStopLoss(); if(MathAbs(cls-stop)>1*Point)continue; switch(OrderType()){ case 0:if(Low<MathMin(cls,stop))fillMe=true;break; case 1:if(High>MathMax(cls,stop))fillMe=true;break; } if(fillMe){ OrderSend(Symbol(),OrderType(),... ... } }
hope this helps...
int b,bLimit=30; double cls, stop; bool fillMe=false; for(int a=OrdersHistoryTotal()-1;a>=0;a--){ if(!OrderSelect(a,SELECT_BY_POS,MODE_HISTORY))continue; b=iBarShift(NULL,0,OrderCloseTime()); if(b>bLimit)continue;//---bLimit is the x no. of the bars for all close trades to be considered cls=OrderClosePrice(); stop=OrderStopLoss(); if(MathAbs(cls-stop)>1*Point)continue; switch(OrderType()){ case 0:if(Low<MathMin(cls,stop))fillMe=true;break; case 1:if(High>MathMax(cls,stop))fillMe=true;break; } if(fillMe){ OrderSend(Symbol(),OrderType(),... ... } }ignore the one above
Thank you diostar. I will be working with the supplied code this weekend.
The scenario is pictured above. The blue square to the left had a signal that hit the stoploss. I need to use the same signal for an entry at a later bar (second blue square), if no new Trade Signals have come up. I have been looking at the code from this link to use last trade data, but that is as far as I have gotten.
Here is my problem. I can't think of a way to code it. I don't need anyone to code this for me, I just want a push in the direction of where I should take my program. Any help would be greatly appreciated.
Best Regards,
Adrian.