Hello,
I wonder if it is possible to program an indicator for the number of open positions. This information is provided in the interface and in back testing so it should be available. Does anyone know how to program this?
Sincerely
Mikael
There are 3 useful keywords for this already existing in PRT language depending on what positions you want to track (see manual page 18):
countofposition
countoflongshares
countofshortshares
These keywords are part of the online documentation: ProBacktest instructions
Thanks guys,
just a follow up question: How can i make contract size contingent on funds or equity?
Sincerely
Mikael
Indicators (Probuilder) can’t retrieve currently opened orders,even with the keywords listed above in previous Noobywan’s post.
Thank you Nicolas,
two more questions:
1. Alarm: Can I have the program send an alert to my mobile when a trade opens or closes?
2. Can I open as position at a certain price instead of “at market”? I want it to open a trade at a certain value but not use a stop order (since stop orders cannot be programmed in pro real code).
Sincerely
Mikael
1. You can’t program alert with code. But you can use your broker interface to send alerts with email. You should contact them.
2. Why? It’s of course possible to code pending stop or limit orders to enter at precise prices.
Thank you,
strange, when i called my broker they said it wasn’t possible to code pending stop/limit orders. What is the code for that?
Sincerely
Mikael
Hi,
If anyone knows how to “code pending stop or limit orders to enter at precise prices” or can direct me to some text explaining it, I would be grateful.
Sincerely
Mikael
Thank you,
I am trying to buy 1.2 contracts by writing “if x then buy 1 contract endif”. The code executes but only buys 1 contract instead of 1.2. Do you know why?
Sincerely
Mikael
Because you can only buy rounded contracts quantity, not with decimals.
Thank you,
One more question: I want to program two stop orders, one long and one short. I only want the long one to trigger if the first was triggered. Do you know how I can do that?
Sincerely
Mikael
Hi again,
Still looking for an answer to the question above but have one more: How can i make to program the code to only allow for a maximum loss of the system?
Sincerely
Mikael
I only want the long one to trigger if the first was triggered. Do you know how I can do that?
You can set your pending long order only if you are shortonmarket on this candle and not in the previous one:
golong = shortonmarket and shortonmarket[1]=0
How can i make to program the code to only allow for a maximum loss of the system?
You can have a look at this blog article: https://www.prorealcode.com/blog/learning/max-profit-loss-day-trading-strategy/ which contain a code snippet to disallow trading when you have reached a certain amount of money loss.