# Convert VT Trader Code to Amibroker



## Dracuu (7 January 2010)

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);


----------



## Wysiwyg (7 January 2010)

Newby with this and need more information on what HaC represents. 

Any clues?

This maybe???? 

haclose:=(O+H+L+C)/4;


----------



## Dracuu (7 January 2010)

Sorry I should have specified what HaC was. HaC is "Heiken-Ashi Close".

Heiken-Ashi bars can be defined in Amibroker like this -

//Define What Heiken-Ashi Bars are.

HaC = (O+H+L+C)/4;
HaO = AMA( Ref( HaC, -1 ), 0.5 );
HaH = Max( H, Max( HaC, HaO ) );
HaL = Min( L, Min( HaC, HaO ) );


----------



## Wysiwyg (7 January 2010)

Tomasz has an explanation of the MS PREV loop function here. Not like a Ref function unfortunately.

http://www.mail-archive.com/amibroker@yahoogroups.com/msg26985.html

Hope this helps.


----------



## Dracuu (7 January 2010)

Thanks mate, I had already looked at that and pretty much every other bit of info on the web but still I cannot get it to work. I end up with something that looks nothing like what it should and it grinds my computer to a halt.

Anyone else?


----------



## saiter (7 January 2010)

Dracuu said:


> Thanks mate, I had already looked at that and pretty much every other bit of info on the web but still I cannot get it to work. I end up with something that looks nothing like what it should and it grinds my computer to a halt.
> 
> Anyone else?




How about you try and explain what the system is meant to do?


----------



## Wysiwyg (8 January 2010)

Saiter, I got the XAO symmetrical triangle breakout target at 5070 using Bulkowski's percentage method. *Also have the apex near 20th of January.*  Thought the apex might interest since you did make note of the pattern.


----------



## Wysiwyg (24 January 2010)

Wysiwyg said:


> Saiter, I got the XAO symmetrical triangle breakout target at 5070 using Bulkowski's percentage method. *Also have the apex near 20th of January.*  Thought the apex might interest since you did make note of the pattern.




The apex lined up reasonably close hey Saiter? Maybe you should trade things like this if you have a belief in them.


----------

