[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Reversal entry in same bar



PureBytes Links

Trading Reference Links

I am trying to code a reversal entry,  only if a particular condition has
been met in the same bar.  The idea is to enter in an “uptrend” and if the
price goes below a level to sell and reverse the position and if this does
happen then  exit at the close.

I am assuming the omega convention of   if the open is closer to the high
the order is OHLC and if open is closer to the low it is OLHC .

What I am finding is that it will still enter before a buy has been
initiated in the same bar or enter without a buy being entered.

Is it possible to achieve the above?

The code is:

Ep = False;
Value1        = Open next bar + Average(Range,3) * ATRM;
Value10      = Value1 - Pnts;
Condition5  = Value1 >= Close;
Condition50= Xaverage(C,21) > Xaverage(C,21) [1] ;

IF marketposition = 0 and Condition50 then begin
    IF Condition5 then begin
 Buy("Buy") at Value1  stop;
             Ep = true;
             end;
    If Ep = true then begin
    Sell("Reverse") at Value10 stop;
    SetExitOnClose;
    EP = false;
end;
Ep= False;
end;

Mel