Hi,
I did look over the rules for posting but unfortunately I forgot my laptop at the office so wont be able to post code etc. However I was looking for some help on the following issue;
I am building a system that I want to QUIT once it reaches a certain price level for example on the EUR/USD at 11500
So I guess my question is how do I input the price level into the code.
Would the code below be correct ?
close[0]> 11500 then
quit
endif
Yes, but don’t forget:
1) IF at the beginning of line 1
2) . to make price 1.1500
DEFPARAM CumulateOrders = False // Cumulating positions deactivated
ignored, indicator2, indicator1 = CALL averages
IF indicator1 crosses under indicator2 THEN
buy 2 PERPOINT AT MARKET
ENDIF
if indicator1 crosses over indicator2 and positionperf(0)>2 then
EXITSHORT at market
endif
if close[0]>11258 then
quit
endif
SET TARGET PROFIT 7
SET STOP LOSS 3
So when I add the price level to my code the system stops running. I am using the system on the USDJPY. I have tried entering the price level as 11258 and 112.58 but on both occasion the system does not run. As soon as I take out the code with the price constraints the system runs fine.
Because while the history is loaded, this condition is met. Try to not load any data when the program start with:
defparam preloadbars=0
But it might affect your indicators calculations, I don’t know what are their calculation periods and the timeframe you are using with this trading strategy.
Hi Nicolas,
I did incorporate the Deparam method and the indicators certainly work when preloadedbars=0. However when I put in certain price levels the system does not run(the system only runs when I put the price level at ridiculously high levels). Which is odd as they are no preloaded bars and the current close[0] on the USDJPY for the backtest is not near the 11258 price level
Thanks again for your helpful input.
Is they any other way that you can set price levels on PRT ?
What TF are you testing on?
I’ll try it out tomorrow, maybe even now! 🙂
Also please provide your Indicator … Averages
Hi Grahal,
Thanks for your input.
I am using very short averages(two days) and ROC indicator again short periods.
I am sure to enter appropriate pre-loaded bars before running the machine so indicators get relevant data.
Look forward to hearing from you.
Kind Regards,
Hi Grahal,
I am using the 10 minute timeframe.
To make it easy for me to help you I need code I can paste into my Platform and then start fault finding when / if it doesn’t run.
I am using very short averages(two days) and ROC indicator again short periods.
I’m doing other stuff and not got time to try this and that and if I did I may not replicate your code so my time could be wasted?
So can you post on here the .itf file as this will contain you Indicator Averages (I think?).
Hi Grahal,
I have actually located the issue and fixed it but thanks for your help.
Hi Grahal,
I did solve the previous issue is seems I was missing a digit from my price level. However I do have a question that I was hoping you might be able to help me on. Of course given the system the price level will change so is it possible to make the price level a variable so you can alter the level from outside of the code and you don’t have to always have the price-level hard=coded into the machine/system ?
I have tried to use variable optimisation as you would when creating an indicator but have had no luck ?
I was missing a digit from my price level
Glad you told us, it’s good to close the loop …. thanks.
I don’t fully understand what you are trying to achieve (the code would help) but in any case I’m not good at coding, but plenty on here are very very good!
Could you not use several Price levels hard coded into the strategy combined with a % distance from etc?
ProOrder only use compiled code, so you can’t change the variables set into the code once the program has been pushed into live trading. There is also no external settings available to change value while the program is running.
Hi Nicolas,
Thanks for the confirmation. One other thing that I wanted to confirm was when your about to run an auto system you are forced to enter a maximum position/stake size.
Now my system is running a 1.5 stake size(Spread Betting) per pip. Is it possible to have a stake size that is a decimal or do you have to choose a whole number ? For example could you have a stake size of and put a max bet in of 2.
Kind Regards,