PureBytes Links
Trading Reference Links
|
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]
------------------------ 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/
|