Portfolio Trader - passing values between strategies with pmm_set/get_my_named_num

Questions about MultiCharts and user contributed studies.
andrei
Posts: 20
Joined: 24 Jan 2013
Has thanked: 2 times
Been thanked: 1 time

Portfolio Trader - passing values between strategies with pmm_set/get_my_named_num

Postby andrei » 29 Nov 2018

Using two strategies w/:
1) one passing a value using pmm_set_my_named_num
2) the MM signal getting it with pmm_get_my_named_num(0,varName) and setting it with pmms_set_strategy_named_num(1,"varName", Value) and
3) the second strategy getting the value with pmm_get_my_named_num

gives following outcome:

00; 1181127.00; 1.00;
01; 1181127.00; 0.00;
MM; 1181127.00; 1.00;
00; 1181127.00; 0.00;
01; 1181127.00; 1.00;
MM; 1181127.00; 0.00;

showing a lag of 1 bar between strategy 00 sending value 1 and strategy 01 getting value 1.
Is it possible to make sure whatever is sent with pmm_set_my_named_num actually gets acoss second strategy within the same bar?

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

Re: Portfolio Trader - passing values between strategies with pmm_set/get_my_named_num

Postby fbertram » 29 Nov 2018

When using pmm_set_my_named_num, this won't work, because the money-management signal is executed *after* the trading strategy. Therefore, your 2nd trading strategy will see the value with a 1 bar lag.

You could use the global variables dll, or something similar, you could even write the value to a file. However, you will still need to make sure that the strategy writing the value is executed before the strategy reading it, otherwise you will end up with the same 1 bar lag.

Hope this helps,
best regards

Felix


Return to “MultiCharts”