Not sure this is what you want...

BuyBarsSince = BarsSince(Buy == 1);
ATROpen = Ref(ATR(20),-BuyBarsSince);

This keeps the ATR as it was when the trade was opened.

Todd K.


--- In amibroker@yahoogroups.com, "murthysuresh" <murthysur...@...> wrote:
>
> hello
> i am trying to print the atr value at print time. but for somereason, i am 
> getting the time out of sync
> tradedatew=1090807;
> tradetime=45346;
> a=ValueWhen(tradedatew==DateNum() AND TimeNum()<=tradetime   ,ATR(14),1);
> _TRACE("ATR" + NumToStr(a));
> a=ValueWhen( tradedatew==DateNum() AND TimeNum()<=tradetime   ,DateNum(),1);
> _TRACE("Date " + NumToStr(a));
> a=ValueWhen(tradedatew==DateNum() AND TimeNum()<=tradetime   ,TimeNum(),1);
> _TRACE("Time " + NumToStr(a));
> 
> my trace keeps printing 43000.000 as time. so i am making a mistake 
> somewhere. my database is running on 1 minute bars.
> 
>   ATR   0.031 ___COMMENTARY___        21      27      19:26:03.06
> Date 1090807.000      ___COMMENTARY___        23      29      19:26:03.07
> Time 45300.000        ___COMMENTARY___        25      29      19:26:03.09
> CLICKED ON    0.000   Formulas\Custom\_Price.afl      1122    50      
> 19:26:03.26
>


Reply via email to