Stoploss' cluster

Questions about MultiCharts and user contributed studies.
TwiceTrader
Posts: 6
Joined: 13 Feb 2018
Has thanked: 1 time

Stoploss' cluster

Postby TwiceTrader » 13 Feb 2018

Good morning to All,
this is my first post here, thus I beg your pardon if mistakes are done.

I have a trading system that shows stop losses clusters. That is for its RTM nature, ie countertrend strategy.
I would like to stop the strategy after first loss and reactivate after first profit.
How could you manage that?

Thanks in advance,
TT

User avatar
TJ
Posts: 7235
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 991 times
Been thanked: 2058 times

Re: Stoploss' cluster

Postby TJ » 13 Feb 2018

Good morning to All,
this is my first post here, thus I beg your pardon if mistakes are done.

I have a trading system that shows stop losses clusters. That is for its RTM nature, ie countertrend strategy.
I would like to stop the strategy after first loss and reactivate after first profit.
How could you manage that?

Thanks in advance,
TT

If you can write out a step-by-step logic,
you can code it into your strategy.

User avatar
fbertram
Posts: 166
Joined: 16 Oct 2014
Location: Seattle, USA
Has thanked: 36 times
Been thanked: 73 times
Contact:

Re: Stoploss' cluster

Postby fbertram » 13 Feb 2018

Hi TT,

what you probably want to do, is to look through the recent strategy positions, and then - depending on what you find - stop the strategy. Have a look at these keywords:
https://www.multicharts.com/trading-sof ... y_Position
https://www.multicharts.com/trading-sof ... ion_Trades

More specifically, you can loop through the last 10 positions, retrieve the ExitName of each, and compare that to the name of your stop loss.


Cheers, Felix

TwiceTrader
Posts: 6
Joined: 13 Feb 2018
Has thanked: 1 time

Re: Stoploss' cluster

Postby TwiceTrader » 14 Feb 2018

Morning TJ and Felix

TJ the logic is quite simple, it is my knowledge that is lagging :-)

If last trade was a loss do not take next trade.

Felix thanks for your response but could you give a simple example with that?
Suppose that I want to introduce a parameter that refer to last 3 trades. This way I could try to optimise if last one, two or three are loss DO NOT take the next one.

Thanks again for your assistance
TT

User avatar
fbertram
Posts: 166
Joined: 16 Oct 2014
Location: Seattle, USA
Has thanked: 36 times
Been thanked: 73 times
Contact:

Re: Stoploss' cluster

Postby fbertram » 14 Feb 2018

Hi TT,

I am a little handicapped giving you an example, as I am actually working with MultiCharts .NET and my memories of PowerLanguage are starting to fade... So please take the following code snippet with a grain of salt and excuse any errors or typos I might have made:

Code: Select all

vars: numPositions, posIdx;

// make sure we can access past values of TotalPositions
numPositions = TotalPositions;

// loop through all new positions
for posIdx = 1 to numPositions[0] - numPositions[1] begin
print(EntryName(posIdx), ExitName(posIdx);
end;
Hope this helps,
Cheers, Felix


Return to “MultiCharts”