setPercentTrailing Question.

Questions about MultiCharts and user contributed studies.
ariliveitup
Posts: 3
Joined: 05 Jun 2010

setPercentTrailing Question.

Postby ariliveitup » 29 May 2011

I have a sample code to test the setPercentTrailing. The following is the code.
if date = 1110527 and time = 1137 then begin
buy ("test buy") 1 shares next bar market;
end;

if marketposition <> 0 then begin
setstopcontract;
setstoploss(500);
setpercenttrailing(200, 50);
end;

The symbol I used was +GC# from IQ feed (1 Gold contract with 100 X leverage). The entry price was at 1,535.8. The profit target was 200 dollars. The highest point was at 1539.50, so I would expect the position to be closed as soon as the low reached below 1538.5 (50% of 200 is 100 which is 1 point). However this didn’t happen and the trade triggered much later at 1,537.6. I have attached a screen shot. Please advise.
Attachments
GC_setPercentTrailing.gif
Trading Example
GC_setPercentTrailing.gif (125.02 KiB) Viewed 87 times

User avatar
TJ
Posts: 6584
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 970 times
Been thanked: 1907 times

Re: setPercentTrailing Question.

Postby TJ » 29 May 2011

ariliveitup wrote:I have a sample code to test the setPercentTrailing. The following is the code.
if date = 1110527 and time = 1137 then begin
buy ("test buy") 1 shares next bar market;
end;

if marketposition <> 0 then begin
setstopcontract;
setstoploss(500);
setpercenttrailing(200, 50);
end;

The symbol I used was +GC# from IQ feed (1 Gold contract with 100 X leverage). The entry price was at 1,535.8. The profit target was 200 dollars. The highest point was at 1539.50, so I would expect the position to be closed as soon as the low reached below 1538.5 (50% of 200 is 100 which is 1 point). However this didn’t happen and the trade triggered much later at 1,537.6. I have attached a screen shot. Please advise.


see post #3
viewtopic.php?f=16&t=6929
These users thanked the author TJ for the post:
Stan Bokov


Return to “MultiCharts”