MultiCharts AND/OR Trading Systems setting

Questions about MultiCharts and user contributed studies.
no erocla
Posts: 134
Joined: 31 May 2013
Has thanked: 60 times
Been thanked: 7 times

MultiCharts AND/OR Trading Systems setting

Postby no erocla » 31 May 2013

Hi all, i'am new of the Forum and i've a question.

How can i set different strategies on different charts, setting them in OR ?

For example:

sys 1 = DAX
sys 2 = FIB
sys 3 = XX

and i would like to have not more then one active system in my broker.

Is it possibile ?

How can i trace marketposition from another chart ?

Best regards.

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: MultiCharts AND/OR Trading Systems setting

Postby Henry MultiСharts » 31 May 2013

Hello,

A strategy can be trading only one instrument that is the main data series of your chart. You need to create a chart for each symbol you want to trade. Then apply a strategy you would like to be trading on this chart.

That is not possible to trace marketposition for a certain instrument from a code applied to a different chart. You can check the marketposition for the instrument/strategy in File->New->Order and position tracker window->Open positions/Strategy posiions.

no erocla
Posts: 134
Joined: 31 May 2013
Has thanked: 60 times
Been thanked: 7 times

Re: MultiCharts AND/OR Trading Systems setting

Postby no erocla » 01 Jun 2013

is not possibile too with global variables ?

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: MultiCharts AND/OR Trading Systems setting

Postby Henry MultiСharts » 03 Jun 2013

That is possible to transfer the information from one chart to the other with the help of Global Variables.

no erocla
Posts: 134
Joined: 31 May 2013
Has thanked: 60 times
Been thanked: 7 times

Re: MultiCharts AND/OR Trading Systems setting

Postby no erocla » 04 Jun 2013

There s not a sample code that can i see ?

Thank you very much again.

Best Regards

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: MultiCharts AND/OR Trading Systems setting

Postby Henry MultiСharts » 04 Jun 2013

Have you checked the Wiki article I have provided above? It says:
Additional info on our discussion forum: viewtopic.php?t=2483
In that thread you can find a zip file Global Variable22.zip with a bunch of information and examples regarding Global Variables. You can also use search on our forum or over the Internet to find examples and more discussions on Global Variables.

no erocla
Posts: 134
Joined: 31 May 2013
Has thanked: 60 times
Been thanked: 7 times

Re: MultiCharts AND/OR Trading Systems setting

Postby no erocla » 06 Jun 2013

I tried to use it but it doesn t works.....very strange.

I wrote this code:

Code 1

Code: Select all

FLAGMA = GVSetInteger(2,flagma);
flagsto = GVGetInteger(1);

IF ( MarketPosition_at_Broker <> 0) then
flagma = 1;
if (MarketPosition_at_Broker = 0) then
flagma = 0;

IF ( marketposition <> 1 and CONDITION2 AND flagsto = 0 ) then
BUY ( "ccilong" ) 1 share NEXT BAR AT MARKET;

IF ( marketposition <> -1 and CONDITION3 AND flagsto = 0) then
SELLSHORT ( "ccishort" ) 1 share NEXT BAR AT MARKET;
Code 2

Code: Select all

flagsto = GVSetInteger(1,flagsto);
flagma = GVGetInteger(2) ;
IF ( MarketPosition_at_Broker <> 0) then
flagsto = 1;
if (MarketPosition_at_Broker = 0) then
flagsto = 0;

IF ( marketposition <> 1 and CONDITION2 AND flagma = 0 ) then
BUY ( "RSILONG" ) 1 share NEXT BAR AT MARKET;

IF ( marketposition <> -1 and CONDITION3 AND flagma = 0) then
SELLSHORT ( "RSISHORT" ) 1 share NEXT BAR AT MARKET;
But it works just sometimes...

Then i try with this:

Code: Select all

IF ( marketposition <> 1 and CONDITION2 and MarketPosition_at_Broker = 0 ) then
BUY ( "long" ) 1 share NEXT BAR AT MARKET;
IF ( marketposition <> -1 and CONDITION3 and MarketPosition_at_Broker = 0 ) then
SELLSHORT ( "short" ) 1 share NEXT BAR AT MARKET;
But i ve the same problem....

Thank you for your time, and thank you again for anyelse answer...

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: MultiCharts AND/OR Trading Systems setting

Postby TJ » 06 Jun 2013

you have to put the GV after the assignment.

eg.

Code: Select all


IF ( MarketPosition_at_Broker <> 0) then
flagma = 1
else
flagma = 0;

FLAGMA = GVSetInteger(2,flagma);
flagsto = GVGetInteger(1);

IF ( marketposition <> 1 and CONDITION2 AND flagsto = 0 ) then
BUY ( "ccilong" ) 1 share NEXT BAR AT MARKET;

IF ( marketposition <> -1 and CONDITION3 AND flagsto = 0) then
SELLSHORT ( "ccishort" ) 1 share NEXT BAR AT MARKET;

no erocla
Posts: 134
Joined: 31 May 2013
Has thanked: 60 times
Been thanked: 7 times

Re: MultiCharts AND/OR Trading Systems setting

Postby no erocla » 06 Jun 2013

Yes true, thank you very much !!


But there s still a little problem, when i have two signals at they same time, variables are both 0 and both systems go on market...


Any idea to solve this problem ?
Maybe giving a delay to 1 code ? (but is not so good like solution.....)


Thx to any answer

Regards

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: MultiCharts AND/OR Trading Systems setting

Postby TJ » 06 Jun 2013

Yes true, thank you very much !!
But there s still a little problem, when i have two signals at they same time, variables are both 0 and both systems go on market...
Any idea to solve this problem ?
Maybe giving a delay to 1 code ? (but is not so good like solution.....)
Thx to any answer
Regards
I can't give you any specifics without examining the code.
Basically you have to design a gatekeeper and execute the orders within the resolution you can manage.

no erocla
Posts: 134
Joined: 31 May 2013
Has thanked: 60 times
Been thanked: 7 times

Re: MultiCharts AND/OR Trading Systems setting

Postby no erocla » 02 Sep 2015

Hello,

i resume this discussion that can be usefull for mc users.

I would like to set some systems in OR to reduce leverage and for other scope.
This means that if i've 10 charts with 10 signals, just 1, 2 or 3 trading system can be active at the same time and not more.

I don t know if is it possibile with Portfolio Trader (i think yes) but anyway, in this case, what would happen if 8 signals will be triggered at the same time ? Can i assign a random priority ?

Regards and thanks for any answer
No Erocla

orion
Posts: 250
Joined: 01 Oct 2014
Has thanked: 65 times
Been thanked: 104 times

Re: MultiCharts AND/OR Trading Systems setting

Postby orion » 04 Sep 2015

I don t know if is it possibile with Portfolio Trader (i think yes) but anyway, in this case, what would happen if 8 signals will be triggered at the same time ? Can i assign a random priority ?
This is easily done in PT. You can use pmm_set_global_named_num() and pmm_get_global_named_num() to keep count of how many strategies have initiated positions.

no erocla
Posts: 134
Joined: 31 May 2013
Has thanked: 60 times
Been thanked: 7 times

Re: MultiCharts AND/OR Trading Systems setting

Postby no erocla » 08 Sep 2015

Dear Orion,

thank you very much for the answer, but i don't understand very well how to solve my problem using those funcions.

Maybe for my scope i've to:

1 - count how many equities are present in my portfolio (pmms_strategies_count)
2 - Don t allow to strategies operate before PMM Instructions (pmms_strategies_deny_entries_all)
3 - Count how many equities are active in my portoflio (pmms_strategies_in_positions_count)
4 - allow strategies to operate if there are not more then "n" equities active (??)

should be a way ? is it correct ?

Regards and thank you again
No Erocla

orion
Posts: 250
Joined: 01 Oct 2014
Has thanked: 65 times
Been thanked: 104 times

Re: MultiCharts AND/OR Trading Systems setting

Postby orion » 08 Sep 2015

There are multiple ways to do this. You can do this using the pmms keywords that you mention. You can also do this without using the pmms keywords by using the following logic. Before making an entry, a strategy checks the global variable using pmm_get_global_named_num(). If the variable is above threshold, then the strategy kills the entry signal. If the variable is below threshold, the global variable is incremented using pmm_set_global_named_num(). Also, upon exit the global variable is decremented.

no erocla
Posts: 134
Joined: 31 May 2013
Has thanked: 60 times
Been thanked: 7 times

Re: MultiCharts AND/OR Trading Systems setting

Postby no erocla » 09 Sep 2015

Ok with this cycle i can scan if there are some open position in my portfolio:

Code: Select all

for idx = 0 to pmms_strategies_count -1 begin
if pmms_strategy_marketposition(idx) <> 0 then
flag = 1;
end;
The problem occurs now, I have to check how many systems want to enter to Market, before that their signal will be triggered.

To do so, i need to scan how many trading system will change their market position:

Image

There's any way to do it ?

Then, i will decide wich of them will open their position.

Regards and thank you again for you time
No Erocla

orion
Posts: 250
Joined: 01 Oct 2014
Has thanked: 65 times
Been thanked: 104 times

Re: MultiCharts AND/OR Trading Systems setting

Postby orion » 09 Sep 2015

Post #14 describes how to do it before the strategy entry signal is acted upon.

no erocla
Posts: 134
Joined: 31 May 2013
Has thanked: 60 times
Been thanked: 7 times

Re: MultiCharts AND/OR Trading Systems setting

Postby no erocla » 11 Sep 2015

Ok but i think that the problem persist.
When can i increase the variabile using pmm_set_global_named_num() function ?


Return to “MultiCharts”