Hello,
I am having problems with cumulative orders. As long as the orders have fixed TP and SL value, everything seems to be ok, but I want to run this with a SL that is based on previous high which makes the SL value different for each order. When there are more than one order open at the same time it seems that PRT cannot separate them. Does anyone know how to solve this issue? You can see more info at the bottom of the PRT code.
Thanks
Robert
Defparam cumulateorders = TRUE
L=1//Loss in Currency
CST=1.5//CANDLE SIZE ENGULFING CANDLE
EMABAR=1
C1 = ExponentialAverage[5](close)//BLUE
C2 = ExponentialAverage[25](close)//GREEN
C3 = ExponentialAverage[50](close)//BLACK
C4 = ExponentialAverage[100](close)//RED
TREND1=CLOSE[1]-OPEN[1]//TREND PREVIOUS CANDLE
TREND0=CLOSE-OPEN//TREND CURRENT CANDLE
CANDLE1=CLOSE[1]-OPEN[1]//SIZE PREVIOUS CANDLE
CANDLE0=OPEN-CLOSE//SIZE CURRENT CANDlE
IF C1[EMABAR]<C4[EMABAR] AND C2[EMABAR]<C3[EMABAR] AND C3[EMABAR]<C4[EMABAR] AND C1[EMABAR]>C2[EMABAR] AND TREND1>0 AND TREND0<0 AND CANDLE0>=CANDLE1*CST THEN
STOPLOSS=(HIGH[1]-CLOSE)*100//100=POINTSIZE???
TAKEPROFIT=STOPLOSS
N=L/STOPLOSS
SELLSHORT N SHARES at MARKET
Set target pprofit TAKEPROFIT
SET STOP pLOSS STOPLOSS
ENDIF
HERE IS THE ISSUE. TIME FRAME 15 JAN 2018 through 28 jan 2018
SECOND TRADE, HIGH[1] is 09:00 18 JAN 2018
HIGH[1] 111.357 – CLOSE 110.937 = 0.420
TRADEPRICE 110.938
TP = 110.518
____HERE COMES THE PROBLEM____
TP WILL BE REPLACED BY THE TIHIRD TRADE´s SL&TP
HOW TO GO AROUND THIS ISSUE?
CLOSE WILL REPLACE CLOSE EVERY NEW CANDLE SAME GOES FOR HIGH[1]. //THIS IS DUE TO A DYNAMIC SL&TP VALUE SET BY PREVIOUS HIGH[1] MINUS CURRENT CLOSE
THANKFUL FOR HELP
Please use the ‘Insert PRT Code’ button when putting code in your posts. I have tidied up your post as best as I can but getting rid of all the ‘shouty’ capitals was a job too far! 🙂
Any time that you change a SET STOP or SET TARGET value it will change the distance/value for all open positions. You can sell individual amounts at individual levels by using STOP and LIMIT orders placed at every bar closure. You should however be aware that partial closure may work in back testing and manual trading but is not possible in ProOrder trading in either demo or live at the moment.
Hello Vonasi,
Thank you for your reply. I tried to upload via the PRT code button, but I obviously failed 🙂 Thanks for your help, cleaning it up!
Now I understand the problem better and it seems that its not possible to solve the way I want it to work. I will try to use fixed SL and TP instead.
BR
Robert