Stop Loss Code

Questions about MultiCharts and user contributed studies.
momentum
Posts: 321
Joined: 23 Nov 2005
Has thanked: 9 times
Been thanked: 14 times

Stop Loss Code

Postby momentum » 05 Dec 2007

Can someone tell me how to code a stop loss where the stop is one tick away from the High or Low of the Bar of Entry? I do a little easylanguage coding but can't get my head around this.

Thanks in Advance.

User avatar
ABC
Posts: 601
Joined: 16 Dec 2006
Has thanked: 118 times
Been thanked: 345 times
Contact:

Postby ABC » 05 Dec 2007

momentum,
basically you can use something like this for example:

Code: Select all

Inputs:
MyStop(0.25); { 1 Tick in ES as an example, you can specify the tick size directly, but for that you need to ensure you have correct settings in QM, so I'd suggest to go with the decimal input}

If my Long Entrycondition is met and BarStatus(1) = 2 then begin
Buy ("LongEntry") this bar at close;
EntryLow = Low;
end;

{so you have stored the low of your Entrybar and can use this for further use:}
If Marketcondition > 0 {i.e. you are long} and Close <= (EntryLow-MyStop) {this way the stop is placed on tick below the Low of the Entrybar} then
Sell ("LongExit") this bar at Close;


This should get you going with only little changes.

Best regards,
ABC

momentum
Posts: 321
Joined: 23 Nov 2005
Has thanked: 9 times
Been thanked: 14 times

Postby momentum » 05 Dec 2007

Many thanks. Really appreciated.


Return to “MultiCharts”