Dollar Trailing

Questions about MultiCharts and user contributed studies.
Thomas Mann
Posts: 173
Joined: 25 Aug 2007

Dollar Trailing

Postby Thomas Mann » 23 Feb 2009

Hi,
I am having a issue with the auto trail command listed below. I asked a question the other day about it but never got an answer so I decided to try again.
When the code listed below triggers I am seeing the Auto trader try to exit the position as expected, but it tries as much as currentask +1 so it never fills on the current bar. Is there a way to tell it to do a market cover order ?
Thanks

if openpositionprofit >= 1 then // This means the profit is >= 1 point
begin

setstopposition;
setdollartrailing(.25);

end;

User avatar
Marina Pashkova
Posts: 2758
Joined: 27 Jul 2007

Postby Marina Pashkova » 24 Feb 2009

Hi Thomas,

Your question is not quite clear. Could you please provide more details on what it is you think is being done wrong?

As for the code that you posted, we have some comments on that.

----------------------------------

if openpositionprofit >= 1 then // This means the profit is >= 1 point

The above line does not mean that the profit is >=1 point. You will need to write the line as:

if openpositionprofit >= 1 point then //


This is when profit is >=1 point.

--------------------------------------

begin
setstopposition;
setdollartrailing(.25); // The value is indicated in dollars. If you want to indicate it in points, you need to write

setdollartrailing(.25*pointvalue);
end;

Thomas Mann
Posts: 173
Joined: 25 Aug 2007

Postby Thomas Mann » 25 Feb 2009

Hi Marina,
Thanks for clarifying that for me. I will play with it some more and see if I can get it to work better. Is there any way to tell a strategy to exit a trade at market this bar ?
Thanks


Return to “MultiCharts”