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

[amibroker] Re: Redefining OHLC Price arrays



PureBytes Links

Trading Reference Links

Terry,
Yes, AFL lines are executed one by one.
[Imagine the horrible mess if it was not the case !!]
On the other side, if you write an undefined "Short", the formula 
will stop and ask to define this unknown "Short".
Dimitris
--- In amibroker@xxxxxxxxxxxxxxx, Terry <MagicTH@xxxx> wrote:
> Dimitris,
> 
> Thanks for having a look. Yes, I am trying to discover the 
conditions (such
> as the value of the RSI) when the trade was opened. This then 
determines how
> the exit is treated. I think thatıs the problem...arrays are 
calculated in
> their entirety as each line of code is processed, hence I cannot 
Œseeı the
> values of a previous buy or short condition since they have not 
Œhappenedı
> yet. Is this your understanding? If yes, I will have to use looping 
code and
> then create a method to replace ValueWhen().
> 
> Thanks. Terry
> --
> 
> > Terry,
> > Some questions:
> > a. In C = IIF(T == -1 AND ValueWhen(Buy,1) < 30 AND X > 50, 1,0); 
and
> > especially in ValueWhen(Buy,1) do you mean what is written ?
> > b. How do you use Short in the 3rd line of your A=... since Short 
is
> > defined many lines later ?
> > Dimitris
> > --- In amibroker@xxxxxxxxxxxxxxx, Terry <MagicTH@xxxx> wrote:
> >> > I need to know if the following is possible, which I think 
depends
> > on how
> >> > arrays are processed in AFL. If arrays are processed in their
> > entirety (all
> >> > bars) as found in each line of code, then the following 
scenario is
> > not
> >> > possible. If they are processed bar by bar for all statements 
then
> > I think
> >> > it is possible. Basically Iım trying to refer to prior bar(s)
> > Buy/Sell
> >> > signals in my conditions which determine current Buy/Sell 
signals.
> >> > 
> >> > X = some indicator such as RSI
> >> > T = determine a market trend as 1 or ­1 (up or down)
> >> > A  = IIF(T == 1 AND ValueWhen(Short,X,1) > 70 AND X < 50, 1, 
0);
> >> > B = other tests giving a Buy signal, but have no reference to 
Buy
> > or Short
> >> > signals;
> >> > C = IIF(T == -1 AND ValueWhen(Buy,1) < 30 AND X > 50, 1,0);
> >> > D = other tests giving a Short signal, but have no reference 
to Buy
> > or Short
> >> > signals;
> >> > 
> >> > MyBuy = IIF(A or B,True,False);
> >> > MyShort = IIF(C or D, True, False);
> >> > BuyState = Flip(MyBuy,MyShort);
> >> > SellState = Flip(MyShort,MyBuy);
> >> > 
> >> > Buy = ref(SellState,-1) AND MyBuy; //Go long if we were Short 
and
> > conditions
> >> > are met
> >> > Sell = some condition;
> >> > Short = ref(BuyState,-1) AND MyShort; //Go short if we were 
Long and
> >> > conditions are met
> >> > Cover = some condition;
> >> > 
> >> > So, I want to test various exits based on conditions at entry, 
but
> > the code
> >> > does not work. It runs, with no errors, but I get different
> > Buy/Short
> >> > results on Graphs vs AA vs Explore (all 3 are different). Iım
> > thinking AFL
> >> > processes each array in itıs entirety as encountered in the 
code,
> > thus the
> >> > computation of BuyState and reference to conditions at 
BuyState are
> > not done
> >> > right (or consistently).
> >> > 
> >> > I hope this is clear. Any insight as to how this works or how 
I can
> >> > reference Buy/Short signals in code that precedes the signal 
being
> > computed
> >> > will be greatly appreciated!
> >> > 
> >> > 
> >> > Additional info:
> >> > I would attach actual code, but itıs over 300 lines so I 
thought
> > the above
> >> > pseudo-code would be more comprehensible. I also have a screen 
shot
> > from
> >> > actual code showing the different results which can be viewed 
here:
> >> > http://www.dtg.addr.com/FutureRef.jpg The upper graph shows 
recent
> > dates
> >> > with raw signals from AA (many Short signals, no Long 
signals). The
> > lower
> >> > graph shows Buy/Short arrows, but there are none, even though 
AA
> > and Explore
> >> > both find trades (there are arrows at other dates where AA has 
no
> > trades).
> >> > The Explore table shown shows three identical trading 
conditions,
> > but only
> >> > one of them actually triggers a Short. Variables in this 
window are
> >> > different that the pseudo code above.
> >> > -- 
> >> > Terry
> >> > 
> >> > 
> >> > 
> >> > [Non-text portions of this message have been removed]
> > 
> > 
> > 
> > Check AmiBroker web page at:
> > http://www.amibroker.com/
> > 
> > Check group FAQ at:
> > http://groups.yahoo.com/group/amibroker/files/groupfaq.html
> > 
> > 
> > Yahoo! Groups Sponsor
> >  
> >  ADVERTISEMENT
> >  
> > 
<http://us.ard.yahoo.com/SIG=129s510f7/M=295196.4901138.6071305.300117
6/D=grou
> > 
ps/S=1705632198:HM/EXP=1093953265/A=2128215/R=0/SIG=10se96mf6/*http://
companio
> > n.yahoo.com>  
> > 
> > 
> > Yahoo! Groups Links
> > * To visit your group on the web, go to:
> > * http://groups.yahoo.com/group/amibroker/
> > *  
> > * To unsubscribe from this group, send an email to:
> > * amibroker-unsubscribe@xxxxxxxxxxxxxxx
> > <mailto:amibroker-unsubscribe@xxxxxxxxxxxxxxx?subject=Unsubscribe>
> > *  
> > * Your use of Yahoo! Groups is subject to the Yahoo! Terms of 
Service
> > <http://docs.yahoo.com/info/terms/> .
> > 
> 
> 
> -- 
> Terry
> 
> 
> 
> [Non-text portions of this message have been removed]



------------------------ Yahoo! Groups Sponsor --------------------~--> 
$9.95 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/J8kdrA/y20IAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/