Hello,
How can I close all open positions within the Portfolio Trader with a Money Management signal?
What I need is to make a portfolio stop loss, for example, when the portfolio is 5000 $ close all the positions.
I have another question and is what does Portfolio_CurrentEntries measures? Is the current open positions? The new orders sent by the strategies or is current open (previous to the last order send)?
Best regards,
Hatman
Close all open positions with Money Management Signal & PT
- TJ
- Posts: 7743
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
Re: Close all open positions with Money Management Signal &
Before you go any further,Hello,
::
I have another question and is what does Portfolio_CurrentEntries measures?
::
please get yourself acquainted with the Wiki.
Go to the "Support" tab at the top of this page,
click on the Wiki,
go to #8 PowerLanguage Keyword Reference
look under [+] Portfolio Strategy Position (5)
You have everything you need there.
Re: Close all open positions with Money Management Signal & PT
hallo, i reply to this old topic because is still not clear to me if is possible to program portfolio setstoploss at 1000$; if today loss is more than 1k i will see only 1k in backtest. i mean in backetst only, not in realtime.
i have tried this code from Wiki but i see no changes; this should stop loss at -1k.
maybe some other settings wrong?
i have tried this code from Wiki but i see no changes; this should stop loss at -1k.
maybe some other settings wrong?
Code: Select all
inputs: StopLossPcntsOfPortfolio(1),
ProfitTargetPcntsOfPortfolio(0.1);
variable: value(0);
setstopposition;
value = StopLossPcntsOfPortfolio * 0.01 * 100000;
setstoploss(convert_currency(datetime[0], portfolio_CurrencyCode, SymbolCurrencyCode, value ));
Last edited by waldem on 31 May 2018, edited 2 times in total.
- TJ
- Posts: 7743
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
Re: Close all open positions with Money Management Signal & PT
here the code.
Code: Select all
inputs: StopLossPcntsOfPortfolio(1),
ProfitTargetPcntsOfPortfolio(0.1);
variable: value(0);
setstopposition;
value = StopLossPcntsOfPortfolio * 0.01 * 100000;
setstoploss(convert_currency(datetime[0], portfolio_CurrencyCode, SymbolCurrencyCode, value ));