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/25/2018 at 12:46 PM #69132
Hello Léo
I don’t understand : MaxX=MaxX=max(x,MaxX)
could you explain me well detailed ??
12345678IF LongOnMarket AND close > TradePrice THENx = (close - tradeprice) / pipsize //convert price to pipsMaxX=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 priceENDIFENDIFCopy paste problem. MaxX is a variable which store the maximum profit and when the profit is at 66% of the higher value it closes the trade.
NOTE: always reset to 0 the MaxX when you open a trade
04/25/2018 at 12:50 PM #69133123456789Once MaxX=0IF LongOnMarket AND close > TradePrice THENx = (close - tradeprice) / pipsize //convert price to pipsMaxX=MaxX=max(x,MaxX) //store the max profit during tradeIF x >= 30 and x < 0.66*MaxX THEN //Exit only if 30+ pipsSELL AT MARKETMaxX=0ENDIFENDIFMaybe like this
04/25/2018 at 3:08 PM #69148MaxX=MaxX=max(x,MaxX)
Copy paste problem again Leo!
04/25/2018 at 4:31 PM #6915304/25/2018 at 7:10 PM #69161Have you ever try to write a code from your mobile phone? No way!
I’m one of those weirdo’s in life who doesn’t have a mobile phone. If someone needs to talk to me that badly they can phone my girlfriend. And as for everything else that a phone can do these days the engineer in me says that it is not the right tool for most of those jobs anyway – which I think you may have just proven.
Must go as trying to add up my losses on my abacus.
04/26/2018 at 7:24 AM #6919004/26/2018 at 7:45 AM #69191The line should read
1MaxX = MAX(x,MaxX)It ensures that the value of MaxX remains at which ever is the highest value of the last highest MaxX and the new x calculated at this bar. This way the value of MaxX can only ever go up and not down.
04/26/2018 at 10:14 AM #69198I am back testing now, I will update the results
alternate way of coding is
x= time of the trade 1 initiated
y=(Highest(2000)(high)- tradeprice)
if ctime >= x and and y>=30 then
if close(1)<= tradeprice+.667*y
sell at market
endif
endif
what is x? in terms for PRT code
picture attached for x
04/26/2018 at 10:52 AM #69203After some testing I changed the code as follows (it seems to be working as expected):
123456789101112IF Not OnMarket THENy = 0ENDIFIF LongOnMarket AND close > (TradePrice + (y * pipsize)) 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 profitENDIFENDIFIF y THEN //Place pending STOP order when y>0SELL AT Tradeprice + (y * pipsize) STOP //convert pips to priceENDIFGive me some feedback.
04/26/2018 at 8:04 PM #69243Many thanks , code seems to be working well results attached.
I will evaluate results and post updates
1 user thanked author for this post.
04/27/2018 at 10:14 AM #6927004/27/2018 at 10:18 AM #6927104/27/2018 at 10:25 AM #6927305/02/2018 at 6:10 PM #69662I want introduce steps of trailing into the stop loss
for steps I have modified code as follows, can you confirm whether this will work ? if not suggest me code changes
12345678910111213141516171819ret=.2ret1=.7IF Not OnMarket THENy = 0ENDIFIF LongOnMarket AND close > (TradePrice + (y * pipsize)) THENx = (close – tradeprice) / pipsize //convert price to pipsIF x >= 10 and x<=30 THEN //go ahead only if 30+ pipsy = max(x * ret, y) //y = 66.6% of max profitENDIFIF x >= 30 and x<=70 THEN //go ahead only if 30+ pipsy = max(x * ret1, y) //y = 66.6% of max profitENDIFENDIFIF y THEN //Place pending LIMIT (not STOP) order when y>0SELL AT Tradeprice + (y * pipsize) stop //convert pips to priceENDIF05/02/2018 at 6:26 PM #69663To write code, please use the <> “insert PRT code” button, to make code easier to read. Thank you.
I’ll take a look at your code ASAP.
-
AuthorPosts
Find exclusive trading pro-tools on