Strategy work in back test but not in DEMO
Forums › ProRealTime English forum › ProBuilder support › Strategy work in back test but not in DEMO
- This topic has 11 replies, 5 voices, and was last updated 1 year ago by Aragorna.
-
-
03/09/2023 at 12:01 AM #211159
Hello everyone,
I’m trying a simple autotrading strategy with PRT Bands, just to test it (I’m using IB), but I don’t understand why it works correctly in backtest but not in DEMO. In Demo it doesn’t open positions, anyone can help me why, please? I’ve got a strategy on gold that works, now I’m testing the strategy on large stocks (Tesla and Nvidia) , but for some reason it doesn work. I’m thinking if the problem is the fact it buys at market and not with limit order?
thank’s anyone in advance who can help me.
123456789101112131415161718192021222324252627282930313233343536//-------------------------------------------------------------------------// Main code : Nuovo3//-------------------------------------------------------------------------// Definition of code parametersDEFPARAM CumulateOrders = False // Cumulating positions deactivated// Conditions to enter long positionsEXP1 = ExponentialAverage[1](close)up = PRTBANDSUPdn = PRTBANDSDOWNEXP50 = ExponentialAverage[50](close)EXP100 = ExponentialAverage[100](close)c2 = (EXP50 >= EXP100)c3 = (EXP100 >= EXP50)if close crosses over up and trend<=0 then //prezzo supera banda superioretrend=1elsif close crosses under dn and trend>=0 then //prezzo ribassa banda inferioretrend=-1ENDIFc4 = trend<>trend[1]//condizione per entrare LongIF NOT longonmarket and Trend=1 and c2 and c4 thenBUY 10 SHARES AT MARKETENDIF// Conditions to exit long positionsIF longonmarket and TREND=-1 and c4 THENSELL AT MARKETENDIF// Stops and targetsSET STOP pLOSS 403/09/2023 at 12:02 AM #21116003/09/2023 at 4:29 AM #211161I’m thinking if the problem is the fact it buys at market and not with limit order?
I think you showed the wrong code because it shows with Market Orders ?
With Demo you mean the PaperTrading option at startup ?
03/09/2023 at 8:46 AM #21116503/09/2023 at 10:10 AM #211179Yes I mean paper trading. ISn’t correct to use Market order in DEMO? I saw it works for gold (but it’s another strategy). by the way my doubt was another one. Since that during pre market and after market you can enter long only with limit order, is it correct to use “Buy at Market” ? I don’t think that is the problem because I verified that the condition to enter was activeted during regular hours.
03/09/2023 at 10:12 AM #21118003/09/2023 at 10:24 AM #21118103/09/2023 at 1:27 PM #21123603/09/2023 at 1:56 PM #21124003/09/2023 at 10:04 PM #211277strategy was lunched on 4th of march, in attachment you see the chart of the strategy where there are no positions open, on the right chart the backtest. As you can see a position should be opened but there is nothing. I cannot explain. someone can understand why?
03/10/2023 at 12:21 PM #21131103/13/2023 at 1:52 PM #211477 -
AuthorPosts
Find exclusive trading pro-tools on