Setting a Hard Stop/Target in Pips

Questions about MultiCharts and user contributed studies.
ClarkFX
Posts: 5
Joined: 06 Jul 2012
Location: Canada
Contact:

Setting a Hard Stop/Target in Pips

Postby ClarkFX » 07 Jul 2012

Hi,

I'm new to using MultiCharts, and have been starting to program my own systems. One of the things I am not sure on is how to set a hard stoploss or take profit in pips (Forex) rather than in % or $ value.

I'm also having troubles finding out to set trailing stops in pips as well.

I tried looking at the manual and searching, but all I can find is how to set up $ or % stops/targets.

Any help would be appreciated.

User avatar
JoshM
Posts: 2195
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1544 times
Been thanked: 1565 times
Contact:

Re: Setting a Hard Stop/Target in Pips

Postby JoshM » 08 Jul 2012

One of the things I am not sure on is how to set a hard stoploss or take profit in pips (Forex) rather than in % or $ value.
You have to manually code this yourself instead of SetDollarTrailing or SetPercentTrailing.

To do so, you'll need to do the following:
* Calculate the highest price reached during a trade (for long),
* Submit a stop-loss order for that trailed price,
* And reset the variable with the highest price reached when the position is closed.

For example:

Code: Select all

Variables:
highestPriceReached(0);

// Code for long positions
if (MarketPosition(0) = 1) then begin

// Stop-loss is trailed 10 pips here
highestPriceReached = MaxList(highestPriceReached, High - 0.0010);

// Submit trailing stoploss
Sell ("XL Trail") all contracts next bar at highestPriceReached stop;

end; //: Long position

// Reset variable
if (MarketPosition(0) = 0) then
highestPriceReached = 0;

ClarkFX
Posts: 5
Joined: 06 Jul 2012
Location: Canada
Contact:

Re: Setting a Hard Stop/Target in Pips

Postby ClarkFX » 08 Jul 2012

Awesome, thank you Josh. I appreciate it. :)

Is there a way to trail orders by the more recent swing high/low formed?

Based off of your code, I would assume it would look something like this:

Code: Select all

Vars: s_high (0);

If MarketPosition = 1 then begin
s_low = SwingLow(1, low, 2, 50);
Sell ("LE Stop") 1 contract next bar at s_low stop;
End;
Thanks again,
Clark


Return to “MultiCharts”