Hi,
Does anyone have some code that works well for closing all trades at the open of a new candle? I can not seem to get it to stop, it closes all new trades as well. A comment in the code shows that CurCandle is equal to 1 for some reason. Anyway, any help appreciated.
Here is what I have come up with:
Static CurCandle=0;
//--------------------
int init()
{
CurCandle=Open[0];
return(0);
}
int deinit()
{
return(0);
}
if(Open[0] != CurCandle)
{
Cls_S=true;
Cls_B=true;
CurCandle=Open[0];
}
This is the relevant part...
Does anyone have some code that works well for closing all trades at the open of a new candle? I can not seem to get it to stop, it closes all new trades as well. A comment in the code shows that CurCandle is equal to 1 for some reason. Anyway, any help appreciated.
Here is what I have come up with:
Static CurCandle=0;
//--------------------
int init()
{
CurCandle=Open[0];
return(0);
}
int deinit()
{
return(0);
}
if(Open[0] != CurCandle)
{
Cls_S=true;
Cls_B=true;
CurCandle=Open[0];
}
This is the relevant part...