Hi All,
I have been trying to convert a system I am using on VT-Trader (Which I think is similar to Metastock code) to Amibroker but I am unable to get my head around the looping stuff in regards to the PREV function. I just cannot get it to work the way it should.
Can anyone please help me?
This is the VT code
{RGM Master Trading System}
RGM_Power_Line_Setup:= (Wilders(ATR(30),24)*2.824);
RGM_Power_Line:= If(BarCount()>(30+24),
If(Ref(HaC,-1)>PREV(0) AND HaC>PREV(0),Max(PREV(0),HaC-RGM_Power_Line_Setup),
If(Ref(HaC,-1)<PREV(0) AND HaC<PREV(0),Min(PREV(0),HaC+RGM_Power_Line_Setup),
If(Cross(HaC,PREV(0)),HaC-RGM_Power_Line_Setup,
If(Cross(PREV(0),HaC),HaC+RGM_Power_Line_Setup,
If(HaC=PREV(0),PREV(0),PREV(0)))))),
NULL);
{Signal Buy and Sell}
LongSignal:= Cross(C,RGM_Power_Line);
ShortSignal:= Cross(RGM_Power_Line,C);
I have been trying to convert a system I am using on VT-Trader (Which I think is similar to Metastock code) to Amibroker but I am unable to get my head around the looping stuff in regards to the PREV function. I just cannot get it to work the way it should.
Can anyone please help me?
This is the VT code
{RGM Master Trading System}
RGM_Power_Line_Setup:= (Wilders(ATR(30),24)*2.824);
RGM_Power_Line:= If(BarCount()>(30+24),
If(Ref(HaC,-1)>PREV(0) AND HaC>PREV(0),Max(PREV(0),HaC-RGM_Power_Line_Setup),
If(Ref(HaC,-1)<PREV(0) AND HaC<PREV(0),Min(PREV(0),HaC+RGM_Power_Line_Setup),
If(Cross(HaC,PREV(0)),HaC-RGM_Power_Line_Setup,
If(Cross(PREV(0),HaC),HaC+RGM_Power_Line_Setup,
If(HaC=PREV(0),PREV(0),PREV(0)))))),
NULL);
{Signal Buy and Sell}
LongSignal:= Cross(C,RGM_Power_Line);
ShortSignal:= Cross(RGM_Power_Line,C);