Is this Buy setup Peeking?

Hi All,

Can you please give some advice on wether this code is peeking? Because on line 19 (Red Box) I use High as a buy condition.


No, it is not a future leak since BuyPrice is at Close.

Still it would be more realistic to use entry delay and BuyPrice at Open.

Buy = Ref(Buy,-1);
BuyPrice = Open;


Sum(Ref(C==O AND O==L AND O==H,-1), 30)

can be shortened to

Sum(Ref(L==H,-1), 30)

If H and L are equal then O and C are equal too as well as O and C being equal to H and L.
Otherwise it would be invalid price bar.

AND BarCount>30 can be removed as far as Sum(..., 30) is concerned. First 30 bars will be NULL anyway. (And I guess you actually meant BarIndex().)

On the other hand if you want to consider rules to be applied to symbols with certain amount of data then you may do like so:

// e.g symbols with greater 4 years of EOD data only
if ( BarCount > 1000 ) { 
    // rules etc....

    // entry/exit signals..
    Buy = ...;
    Buy Price = ....;

    Sell = ....;
    SellPrice = ....;


Thanks for the fast reply man. It's very kind of you to spend the time to provide your expertise. I always pay more attention to your post as I learn new things from them.

1 Like

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.