Hello.
I have an ongoing auto trade on Spot Gold 2 min chart.
When I start the auto trade I am asked the max position size I want. I set it for 2.
I buy 1 contract in the code. The code buys 1 contract. Sometimes it does not reach the sell condition and it falls back and reaches the buy conditions I set one more time. Now the price may be lower than the buying price on the first contract I bought earlier.
How can I now buy one new contract even though I already have one?
// Definition of code parameters
DEFPARAM CumulateOrders = False // Cumulating positions deactivated
// Conditions to enter long positions
indicator1 = Stochastic[14,3](close)
c1 = (indicator1 < 20)
indicator2 = Stochastic[14,3](close)
indicator3 = Average[5](Stochastic[14,3](close))
c2 = (indicator2 CROSSES OVER indicator3)
IF c1 AND c2 THEN
BUY 1 CONTRACT AT MARKET
ENDIF
// Conditions to exit long positions
indicator4 = Stochastic[14,3](close)
c3 = (indicator4 > 80)
indicator5 = Stochastic[14,3](close)
indicator6 = Average[5](Stochastic[14,3](close))
c4 = (indicator5 CROSSES UNDER indicator6)
IF c3 AND c4 THEN
SELL AT MARKET
ENDIF
// Stops and targets
SET STOP pLOSS 5
Hi, I’ll edit your previous message for you, but please:
> For clarity of messages on ProRealCode’s forums, please use the “insert code PRT” button to separate the text of the code part! Thank you! <<
https://www.prorealcode.com/topic/automatic-trading-support-posting-rules/
If you want to add another position, while you are already on market, just set this line to true:
DEFPARAM CumulateOrders = true
Now the system will know you allow it to have more than 1 order on market.
Thanks.
It works.
Is it then limitited to the maxs position size I set when I start the auto trade?
The max position size you set when you launch a strategy with ProOrder will ALWAYS be a priority to what you have coded as max positions/orders in your script.
ramaParticipant
Senior
DEFPARAM CumulateOrders = False
say maximum position size “2” amount/pt
does it mean maximum points or amount should be open max at any given point time
if the program conditions are met any it will keep open a maximum of 2 points or amount