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

Re: Reversal entry in same bar



PureBytes Links

Trading Reference Links

I think your code can be simplified to:

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 and Condition5 then begin
   Buy("Buy") at Value1 stop;
   Sell("Reverse") at Value10 stop;
   SetExitOnClose;
end;

which is probably not what you wanted. (The variable Ep was basically
doing nothing.)

You cannot count on both an entry and an exit on stops on the same
bar. Omega assumes some order of progression throughout the bar but
the real behavior within the bar cannot be determined from just the
OHLC values of the bar.

You should increase the time resolution to get at least 10 bars in a
trade, preferably 20. This way, what happens within any bar will not
have much effect on the results.

Bob Fulks 

At 3:34 PM +1000 7/9/01, Mel wrote:
>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