bool tradeSignal=false; // this variable has global scope
double stopPrice=0; // this variable has local scope
if(BarsInProgress==0)
{
if(Close[0]>High[1]) // trade signal condition
{
tradeSignal=true;
stopPrice=High[0];
}
}
if(BarsInProgress==1)
{
if(Close[1][0]>stopPrice && tradeSignal==true) // trying to compare current intrabar price to signal bars high
{
EnterLong(1,100,"Long: 10min") // trying to execute market order at intrabar price
tradeSignal=false;
}
}
// logic to exit if daily close<previous day's low...
if(BarsInProgress==0)
{
if(Close[0]<Low[1])
{
ExitLong("Long: 10min");
tradeSignal=false;
}
}

Comment