You can make some small changes to bring the definition of true
range to be in line how they are normally defined.
TrueHigh = max(H, ref(c, -1));
TrueLow = min(L, ref(c, -1));
TrueRange = TrueHigh - TrueLow;
/Paul.
--- In [email protected], "droskill" <drosk...@...> wrote:
>
> 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.
>