Preventing multiple trades from initiating across different charts at the same time

Questions about MultiCharts and user contributed studies.
mondayyellow
Posts: 2
Joined: 14 Sep 2018
Has thanked: 1 time

Preventing multiple trades from initiating across different charts at the same time

Postby mondayyellow » 14 Sep 2018

I am new to power language coding.
I want to find a way to restrict multiple trades from initiating across different charts at the same time.

I have two signals, one for buy and one for sell in every strategy - the signals are exactly the same for every strategy across every chart.
Every chart also has a different instrument operating in it, for example chart # 1 has EUR/USD then chart # 2 might have AUD/USD and so on.

Since every chart has the same signal, sometimes what happens is that across pairs which are correlated, i might end up getting losing/winning trades in a row which is not the way i want to go about it, there is too much risk involved.

I did some research and what i concluded was that MC tries to keep all the charts separated so we do not have one chart effecting the other - which makes sense. But in my case i would like to have a kind of a "Semaphore lock", which enables me to only allow 1 chart to initiate a trade at once. This would allow me to fair queue every chart ( so that every chart gets a turn ), But prevent lets say 8 Losing trades from initiating across the different correlated charts.

Lastly, what i thought to be a possible solution was Global Variables. From what i understand is that global variables allow me to pass information between multiple charts, in that case i could possibly share a piece of data between the different charts - say like a lock variable, once that is held by a chart the rest of charts can not enter a trade.

What are your thoughts on this ? is there a better way to accomplish this goal ? is there some built in function in power language for achieving this. Thank you in advance :).

hughesfleming
Posts: 275
Joined: 22 Apr 2014
Has thanked: 70 times
Been thanked: 72 times

Re: Preventing multiple trades from initiating across different charts at the same time

Postby hughesfleming » 15 Sep 2018

@mondayyellow

You should consider using Portfolio trader. If you must use GV's then I prefer to use something like sharedvar. It is a dll and management app that makes this kind of setup quite easy.

I have 100 signals on US big caps and use sharedvar to keep track of market position.
SharedVar.JPG
(75.63 KiB) Downloaded 316 times

mondayyellow
Posts: 2
Joined: 14 Sep 2018
Has thanked: 1 time

Re: Preventing multiple trades from initiating across different charts at the same time

Postby mondayyellow » 16 Sep 2018

thanks for your answer, i will try out sharedVar. another question i have is that does the Portfolio trader allow me to somehow stop multiple trades from going on at once ?

hughesfleming
Posts: 275
Joined: 22 Apr 2014
Has thanked: 70 times
Been thanked: 72 times

Re: Preventing multiple trades from initiating across different charts at the same time

Postby hughesfleming » 17 Sep 2018

How are you managing the correlations? If you can figure out a way to see which pairs are correlated at any one moment then you should be able to sort them. From there you should be able to list which symbols should trade and which should not. Portfolio trader is ideal for this but it is more complicated to setup than running a single strategy on a single instrument in Multicharts.


Return to “MultiCharts”