It's possible to use this function to calculate number of consecutive losses
int CountLosses()
int orders=HistoryTotal(); // background orders complete
int losses=0; // number of losses orders without a fracture
//-- calculate number of loosing trades without a rest at precisely the exact same day
for(int I=orders-1;igt;=0;I--)
OrderType()gt;OP_SELL) continue;
//--
if(OrderProfit()gt;0) break;
if(OrderProfit()lt;0 TimeDay(OrderOpenTime()) == TimeDay(Timing[0])) Gains ;
//-- yield losses
yield(losses);
to use it :
int Losses = CountLosses();
to limit 1 trade per hour:
define global variable, place before int start(), title it LastHourBar
int LastHourBar=0;
....
Int start()
{
...
if(Buy/Sell Condition == True... iBars(NULL,PERIOD_H1) ! = LastHourBar)
OrderSend(...)
LastHourBar = iBars(NULL,PERIOD_H1);
...




Reply With Quote