CumulateOrders is not working ?

Forums ProRealTime English forum ProOrder support CumulateOrders is not working ?

Viewing 14 posts - 1 through 14 (of 14 total)
  • #78106

    Hi folks,

    A. I would like that my system accumulates positions every time my conditions are met (this can happen on two consecutive candles for instance). I’m using the following code as parameter but it is not working

    Every time I am in a position and the conditions are met again, the system doesn’t buy a new position.

    B. My exit rules are either stop loss at 2% below low of candle of entrance or once a target profit of 15% is reached. Because of that, I obviously don’t want the system to accumulate positions and sell those altogether if I get 15% return on the first shares bought (before accumulation) ot if we reach the stop-loss level of the first shares bought for instance. Is the system treating every buy as a separate “bundle” and consequently only sells a bundle if conditions are met for this bundle ?

    Thanks for your help !!

    #78109

    Did you set the max number of contracts to something greater than 1 at launch time?

    ProBackTest doesn’ t care about it and works correctly, while ProOrder DOES need to know the max number of contracts it is allowed to trade.

    #78111

    Hey Roberto ! I am backtesting (on stocks only). I set an initial capital of 100.000 euros and ask the system to trade “10.000 cash at market” every time the signal is met.

    #78113

    Try replacing 10,000 with 1, or 100,000 with 100,000,000.

    #78159

    I tried but this doesn’t make any difference. Is there any particularity of use of the “Cumulateorders” parameter ?

    #78162

    You may be best to share the code as without it we are just guessing. You might just have an IF ONMARKET in the wrong place for all we know. It must be a coding error as cumulate orders works fine in all the codes I test it in.

    #78164

    every time the signal is met.

    Are you sure the signal is met multiple times in your strategy? Try to GRAPH the variable that trigger the signal.

    #78177

    Here is the full code. It is a code for going short (and not long as I said for comfort reasons in my previous messages).

    C4, C5 and C6 are to define the type of candle I’m looking for (length of shadows, length of candle as % of close price, etc.).

    In order to check what Prorealtest does, I took a stock and noted down on paper every candle that respect my rules. This code shorts the right candles except when I’m already in short position. If two following candles respect my rules, Probacktest always shorts on the first one and never on the second. If it was a mistake in my code, Prorealtest would sometimes short on the first candle, sometimes on the second.

     

    #78178

    DAMN. I see my mistake now. I mentioned “If not short on market” whereas I don’t care about that and want the system to short anyway.

    Sorry and thanks for the help.

    #78179

    May I come back to the second point of my first post as it seems that the system sells all positions together and doesn’t respect the stop loss rule of the first short position taken. It seems to decide to sell everything based on the stop loss level or 15% target profit as calculated on the second candle of entry.

    B. My exit rules are either stop loss at 2% (above) below low of candle of entrance or once a target profit of 15% is reached. Because of that, I obviously don’t want the system to accumulate positions and sell those altogether if I get 15% return on the first shares bought (before accumulation) ot if we reach the stop-loss level of the first shares bought for instance. Is the system treating every buy as a separate “bundle” and consequently only sells a bundle if conditions are met for this bundle ?

    #78180

    Yes that NOT  SHORTONMARKET is why it only opens one trade.

    Surely line 26 is also wrong and should be an EXITSHORT rather than a BUY?

    #78181

    If you put a pending order at a price it will sell all positions at that price. If you SET a target level or stop level then each position will have individual exit prices.

    #78182

    Thank you, I replaced Buy and put Exitshort instead.

    You see the full code. I don’t know what you mean by pending orders, I never used that.I see on the chart that on a given moment, while the system did accumulate positions as wanted, Prorealtest didn’t respect my stoploss rule of 2% above the high of the first candle of entry and sold all accumulated positions at 15% profit calculated on the second candle of entry. He should have sold my first short position at stop loss level whereas I still would hold the second short position (for which its stop loss level was never reached).

    #78223

    If the last bit of your code is now like this:

    …then every time the entry conditions are met then your SL value will be changed.

    The following is a pending order:

    It places an order on the market to close all trades at whatever the value of SL is. STOP is at an inferior price and LIMIT is at a superior price.

    There is no way to have different values of stop loss or take profit for different positions. You can either exit all trades at a certain price with a pending order or use the SET instruction to place orders a set distance from each individual position but every time you change the value it changes the distance for all open trades.

    With partial closure you could make this work by selling parts of your position at different levels but although partial closure works in back testing it is not yet possible to forward test using it in demo. I’m not sure if it works in live trading but then again I would never run anything live that has not been forward tested so that is irrelevant anyway.

     

    2 users thanked author for this post.
Viewing 14 posts - 1 through 14 (of 14 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login