profit reduces by 33%
Forums › ProRealTime English forum › ProOrder support › profit reduces by 33%
- This topic has 39 replies, 6 voices, and was last updated 5 years ago by GraHal.
-
-
04/24/2018 at 7:51 AM #69043
I have a buy order
initial stop is 20
market went in my favor say to 30,40,50 etc
when market moves back I want keep 66 .6 profit
if longonmarket then
if ( x-close)<=.66*(close-tradeprice) then
sell at market
endif
endif
what is the X? how to code variable X
04/24/2018 at 9:24 AM #69049Try this one
1234567IF LongOnMarket AND close > TradePrice THENx = (close - tradeprice) / pipsize //convert price to pipsIF x >= 30 THEN //go ahead only if 30+ pipsy = x * 0.666 //y = 66.6% of current profitSELL AT close - (y * pipsize) STOP //convert pips to priceENDIFENDIFRoberto
04/24/2018 at 9:34 AM #69052I’ve added above to the Snippet Link Database
https://docs.google.com/spreadsheets/d/1rgboqj7sVwsP9ZRhOduOefye48QMWC07jWVXCl-KJPU/edit?usp=sharing
Thank You @robertogozzi
1 user thanked author for this post.
04/24/2018 at 9:55 AM #69055I’ve added above to the Snippet Link Database
https://docs.google.com/spreadsheets/d/1rgboqj7sVwsP9ZRhOduOefye48QMWC07jWVXCl-KJPU/edit?usp=sharing
Thank You @robertogozzi
Sorry GraHal, I forgot to (as I do most of times). Thanks for paying attention.
04/24/2018 at 10:55 AM #69065Thanks for your fast reply Roberto. I have am back testing this now, will take another 4 to 5 hours get decent result.
I my guess it may not work, as soon as the profit falls below the 30 , the stop will go to the original stop loss
I am keeping fingers crossed, I will post the results by EoD today
04/24/2018 at 11:04 AM #69067This trailing SL is hard coded in your strategy, not managed by ProOrder or your broker, it’s a pending order to be set at each new candle.
You may as well have set your stop ploss at, say 100 pips, but still exit in profit as this code is progressing candle after candle.
04/24/2018 at 11:37 AM #69071please find the screen shots
if max profit once gone past 30 say 36
I want keep stop loss .66(tradeprice+36) at least in the event market is coming back.
on the other hand if the profit goes to 60 i want keep .66(tradeprice+60)
I tested the code is not working, as the price keeps falling after >=30 SL coming down by .33%
04/24/2018 at 11:49 AM #69074Well… It works almost like that, but if it reaches 50 pips profit Y will be set to 33.3, but if the next candle decreases to 40 pips profit, it won’t keep 33.3 but will decrease to 26.6.
I will make a change.
04/24/2018 at 11:55 AM #69075This should work
12345678910IF Not OnMarket THENy = 0ENDIFIF LongOnMarket AND close > TradePrice THENx = (close - tradeprice) / pipsize //convert price to pipsIF x >= 30 THEN //go ahead only if 30+ pipsy = max(x * 0.666, y) //y = 66.6% of max profitSELL AT close - (y * pipsize) STOP //convert pips to priceENDIFENDIF04/24/2018 at 11:55 AM #6907604/24/2018 at 12:31 PM #6908004/25/2018 at 1:24 AM #6911004/25/2018 at 6:43 AM #6911812345678IF LongOnMarket AND close > TradePrice THENx = (close - tradeprice) / pipsize //convert price to pipsMaxX=MaxX=max(x,MaxX) //store the max profit during tradeIF x >= 30 THEN //go ahead only if 30+ pipsy = MaxX * 0.666 //y = 66.6% of current profitSELL AT TradePrice + Y*pipsize STOP //convert pips to priceENDIFENDIFTry this.
04/25/2018 at 7:01 AM #6912004/25/2018 at 11:57 AM #69128 -
AuthorPosts
Find exclusive trading pro-tools on