PureBytes Links
Trading Reference Links
|
Hey all - trying to translate a system but having some issues. Here's
the original EasyLanguage:
Input: StopPts (30); { Size of money management stop, points }
Var: TR (0); { True Range }
TR = TrueRange;
Condition1 = TR < TR[1] and TR < TR[2];
Condition2 = C > C[14] and C < C[2];
Condition3 = C < C[14] and C > C[2];
If Condition1 and Condition2 then
Buy next bar at Highest(H, 2) stop;
If Condition1 and Condition3 then
Sell short next bar at Lowest(L, 2) stop;
If MarketPosition = 1 and C > EntryPrice and BarsSinceEntry >= 1 then
Sell this bar at close;
If MarketPosition = -1 and C < EntryPrice and BarsSinceEntry >= 1 then
Buy to cover this bar at close;
If MarketPosition = 1 then
Sell next bar at EntryPrice - StopPts stop;
If MarketPosition = -1 then
Buy to Cover next bar at EntryPrice + StopPts stop;
-----------------------------------
Here's what I've got - it ain't working:
TR1 = abs(H-L);
TR2 = abs(H-Ref(C,-1));
TR3 = abs(Ref(C,-1)-L);
TRa = Max(TR1,TR2);
TRb = Max(TR2,TR3);
TR = Max(TRa,TRb);
Condition1 = TR < Ref(TR,-1) AND TR < Ref(TR,-2);
Condition2 = C > Ref(C,-14) AND C < Ref(C,-2);
Condition3 = C < Ref(C,-14) AND C > Ref(C,-2);
Buy = Condition1 AND Condition2;
BuyPrice = HHV(H,2);
Sell = C > BuyPrice AND BarsSince(Buy) >= 1;
Short = Condition1 AND Condition3;
ShortPrice = LLV(L,2);
Cover = C < ShortPrice AND BarsSince(Short) >= 1;
ApplyStop(stopTypeLoss,stopModePoint,30,0);
------------------------------
Any thoughts greatly appreciated.
------------------------------------
**** IMPORTANT ****
This group is for the discussion between users only.
This is *NOT* technical support channel.
*********************
TO GET TECHNICAL SUPPORT from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com
*********************
For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
For other support material please check also:
http://www.amibroker.com/support.html
*********************************
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/amibroker/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:amibroker-digest@xxxxxxxxxxxxxxx
mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx
<*> 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/
|