PMMS_Strategy_Close_Position appears to close orders at the close of the current bar.
How would it be possible to modify this to have Portfolio Trader positions close at the open of the following bar?
Close PT Orders at Open
-
- Posts: 20
- Joined: 21 Dec 2009
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2957 times
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2957 times
Re: Close PT Orders at Open
Hello TradingPro,
Portfolio Money Management Signal needs to know the events of all data series therefore it is called on each new tick (it runs in IOG).
PMMS_Strategy_Close_Position can close the position intrabar, not only on bar close. Position will be closed on the next calculation following the one when PMMS_Strategy_Close_Position was called.
In order to close the position at bar open you can call PMMS_Strategy_Close_Position when barstatus=0.
Portfolio Money Management Signal needs to know the events of all data series therefore it is called on each new tick (it runs in IOG).
PMMS_Strategy_Close_Position can close the position intrabar, not only on bar close. Position will be closed on the next calculation following the one when PMMS_Strategy_Close_Position was called.
In order to close the position at bar open you can call PMMS_Strategy_Close_Position when barstatus=0.
-
- Posts: 20
- Joined: 21 Dec 2009
Re: Close PT Orders at Open
Thank you for you assistance Henry.
I was hopeful that the advice you provided would be sufficient however I am currently stuck with positions not closing at al right now.
Referring to the Portfolio Trader Strategy Examples I can demonstrate precisely what is needed here: https://www.multicharts.com/trading-sof ... y_Examples
In the Portfolio_Rotation_MM Signal strategies which are in position, but are not among the best according to the indicator indexes are forced to close as follows:
This code closes the positions at the close of the current bar instead of the open of the following bar which is required.
Following your advice above, the following modification to the code above does not close ANY positions:
It appears that Value1 >= 0 and BarStatus(1) = 0 will always return FALSE
How could we get the Portfolio_Rotation_MM Signal in the Portfolio_Trader_Strategy_Examples to close all positions at the open of the next bar?
I was hopeful that the advice you provided would be sufficient however I am currently stuck with positions not closing at al right now.
Referring to the Portfolio Trader Strategy Examples I can demonstrate precisely what is needed here: https://www.multicharts.com/trading-sof ... y_Examples
In the Portfolio_Rotation_MM Signal strategies which are in position, but are not among the best according to the indicator indexes are forced to close as follows:
Code: Select all
For IDX = 0 To InLong - 1 Begin
Value1 = StrategiesLong[IDX];
If Value1 >= 0 Then Begin
PMMS_Strategy_Close_Position(Value1);
If Use_Logging Then Print("Long Exit: ",PMMS_Strategy_Symbol(Value1));
End;
End;
Following your advice above, the following modification to the code above does not close ANY positions:
Code: Select all
For IDX = 0 To InLong - 1 Begin
Value1 = StrategiesLong[IDX];
If Value1 >= 0 and BarStatus(1) = 0 Then Begin
PMMS_Strategy_Close_Position(Value1);
If Use_Logging Then Print("Long Exit: ",PMMS_Strategy_Symbol(Value1));
End;
End;
How could we get the Portfolio_Rotation_MM Signal in the Portfolio_Trader_Strategy_Examples to close all positions at the open of the next bar?
Last edited by TradingPro on 23 Dec 2016, edited 1 time in total.
- TJ
- Posts: 7743
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2223 times
-
- Posts: 20
- Joined: 21 Dec 2009
Re: Close PT Orders at Open
Thank you for the tip TJ (I've not visited this forum for approx 6 years now)
Over to MC staff for a solution please.
Over to MC staff for a solution please.
-
- Posts: 20
- Joined: 21 Dec 2009
-
- Posts: 20
- Joined: 21 Dec 2009
- Angelina MultiСharts
- Posts: 260
- Joined: 28 Dec 2016
- Has thanked: 28 times
- Been thanked: 66 times
Re: Close PT Orders at Open
Hello TradingPro,
BarStatus(1) = 0 is possible only for the realtime calculation. For the calculation on historical bars BarStatus(1) will always return 2, as all the bars are closed.
BarStatus(1) = 0 is possible only for the realtime calculation. For the calculation on historical bars BarStatus(1) will always return 2, as all the bars are closed.
Last edited by Angelina MultiСharts on 18 Jan 2017, edited 1 time in total.
-
- Posts: 20
- Joined: 21 Dec 2009
Re: Close PT Orders at Open
Thank you for your reply Angelina.
So going back to the original requirement:
PMMS_Strategy_Close_Position appears to close orders at the close of the current bar.
How would it be possible to modify this to have Portfolio Trader positions close at the open of the following bar?
... is there really no way for Portfolio Trader to do this?
So going back to the original requirement:
PMMS_Strategy_Close_Position appears to close orders at the close of the current bar.
How would it be possible to modify this to have Portfolio Trader positions close at the open of the following bar?
... is there really no way for Portfolio Trader to do this?
- Angelina MultiСharts
- Posts: 260
- Joined: 28 Dec 2016
- Has thanked: 28 times
- Been thanked: 66 times
Re: Close PT Orders at Open
TradingPro,
Unfortunately, it is not possible for historical calculations.
Unfortunately, it is not possible for historical calculations.