PDA

View Full Version : TradeSim Trialingstop function


gsandral
1st April 2007, 01:18 PM
Jose this relates to some code you put together for me

Can the tailing stop entry below be referenced to the XJO in explorations and when placed on other charts?

StopShort:=Ref(ExtFml("TradeSim.TrailingStop",band,short,0,HHV(H,13)+HHV(H-Max(O,C),2),L), -1);

I thought this would do it but its not working!

XO:=Security("C:\Trading Data\Stocks\ASX\Indices\XAO",O);
XH:=Security("C:\Trading Data\Stocks\ASX\Indices\XAO",H);
XL:=Security("C:\Trading Data\Stocks\ASX\Indices\XAO",L);
XC:=Security("C:\Trading Data\Stocks\ASX\Indices\XAO",C);
StopShort:=Ref(ExtFml("TradeSim.TrailingStop",band,short,0,HHV(XH,13)+HHV(XH-Max(XO,XC),2),XL), -1);

Regards Graeme

Jose
2nd April 2007, 08:45 AM
It works fine at my end, Graeme.

---8<------------------------------------

XO:=Security("C:\Norgate\ASX\Indices\XAO",O);
XH:=Security("C:\Norgate\ASX\Indices\XAO",H);
XL:=Security("C:\Norgate\ASX\Indices\XAO",L);
XC:=Security("C:\Norgate\ASX\Indices\XAO",C);
X10:=Security("C:\Norgate\ASX\Indices\XAO",ATR(10));

StopLong:=Ref(ExtFml("TradeSim.TrailingStop", band,long,5*X10+HHV(Min(XO,XC)-XL,2), XH,XC),-1);

StopShort:=Ref(ExtFml("TradeSim.TrailingStop",band,short,0,HHV(XH,13)+HHV(XH-Max(XO,XC),2),XL), -1);

StopLong;StopShort;XC

---8<------------------------------------


Try the trigger function for the stop breach signals:

---8<------------------------------------

XO:=Security("C:\Norgate\ASX\Indices\XAO",O);
XH:=Security("C:\Norgate\ASX\Indices\XAO",H);
XL:=Security("C:\Norgate\ASX\Indices\XAO",L);
XC:=Security("C:\Norgate\ASX\Indices\XAO",C);
X10:=Security("C:\Norgate\ASX\Indices\XAO",ATR(10));

StopLong:=Ref(ExtFml("TradeSim.TrailingStop", trigger,long,5*X10+HHV(Min(XO,XC)-XL,2), XH,XC),-1);

StopShort:=Ref(ExtFml("TradeSim.TrailingStop",trigger,short,0,HHV(XH,13)+HHV(XH-Max(XO,XC),2),XL), -1);

StopLong-StopShort

---8<------------------------------------


jose '-)