Need help with FX trail!
Forums › ProRealTime English forum › ProOrder support › Need help with FX trail!
- This topic has 11 replies, 4 voices, and was last updated 7 years ago by
bezieh.
Viewing 12 posts - 1 through 12 (of 12 total)
-
-
06/19/2018 at 7:39 PM #73693
Hey guys!
I got this code for trailing, and it works as it should in index markets, but for forex, it has no affect, it doesn’t work, no matter whatever values you put in it.
Can someone please help me with this problem? I’d really appreciate it!Heres the FULL code!
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859//trailing stop 1trailingstop1 = 70bottomTrailingStopValue1 = 30TopTrailingStopValue1 = 70//trailing stop 2//trailingstop2 = 10//bottomTrailingStopValue2 = 71//TopTrailingStopValue2 = 150"//resetting variables when no trades are on marketif not onmarket thenMAXPRICE1 = 0priceexit1 = 0endifa = close-tradeprice(1) > bottomTrailingStopValue1*pointsizeb = close-tradeprice(1) < TopTrailingStopValue1*pointsize//case LONG orderif longonmarket thenMAXPRICE1 = MAX(MAXPRICE1,close) //saving the MFE of the current tradeif a and b thenif MAXPRICE1-tradeprice(1)>=trailingstop1*pointsize then //if the MFE is higher than the trailingstop thenpriceexit1 = MAXPRICE1-trailingstop1*pointsize //set the exit price at the MFE - trailing stop price levelendifendifendif//exit on trailing stop price levelsif onmarket and priceexit1>0 thenEXITSHORT AT priceexit1 STOPSELL AT priceexit1 STOPendif//resetting variables when no trades are on market//if not onmarket then//MAXPRICE2 = 0//priceexit2 = 0//endif//a2 = close-tradeprice(1) > bottomTrailingStopValue2*pointsize//b2 = close-tradeprice(1) < TopTrailingStopValue2*pointsize//case LONG order//if longonmarket then//MAXPRICE2 = MAX(MAXPRICE2,close) //saving the MFE of the current trade//if a2 and b2 then//if MAXPRICE2-tradeprice(1)>=trailingstop2*pointsize then //if the MFE is higher than the trailingstop then//priceexit2 = MAXPRICE2-trailingstop2*pointsize //set the exit price at the MFE - trailing stop price level//endif//endif//endif//exit on trailing stop price levels//if onmarket and priceexit2>0 then//EXITSHORT AT priceexit2 STOP//SELL AT priceexit2 STOP//endif06/19/2018 at 8:15 PM #7369506/19/2018 at 9:16 PM #7370106/19/2018 at 9:28 PM #7370506/19/2018 at 10:21 PM #7371106/19/2018 at 10:52 PM #7371406/19/2018 at 11:04 PM #73715Value in line 2 is too big, since it is = TopTrailingStopValue1, thus line 24 bwill never be true.
Try any value between 31 and 69.
06/19/2018 at 11:37 PM #7371606/19/2018 at 11:38 PM #7371706/20/2018 at 1:48 AM #73718I have tried this either on Dax h1 and Eur/Usd h1, and it always worked with a value of trailingstop1 = 40:
1234567891011121314151617181920212223242526272829303132DEFPARAM CumulateOrders = Falsetrailingstop1 = 40bottomTrailingStopValue1 = 30TopTrailingStopValue1 = 70if not onmarket thenMAXPRICE1 = 0priceexit1 = 0endifa = close-tradeprice(1) > bottomTrailingStopValue1*pointsizeb = close-tradeprice(1) < TopTrailingStopValue1*pointsizeif longonmarket thenMAXPRICE1 = MAX(MAXPRICE1,close) //saving the MFE of the current tradeif a and b thenif MAXPRICE1-tradeprice(1)>=trailingstop1*pointsize then //if the MFE is higher than the trailingstop thenpriceexit1 = MAXPRICE1-trailingstop1*pointsize //set the exit price at the MFE - trailing stop price levelendifendifendifif onmarket and priceexit1>0 thenEXITSHORT AT priceexit1 STOPSELL AT priceexit1 STOPendifIF close CROSSES OVER average[20,0](close) THENBUY AT MARKETSET TARGET pPROFIT 250SET STOP pLOSS 200ENDIFgraph agraph bgraph MAXPRICE1graph priceexit1graph MAXPRICE1-tradepricedid you use GRAPH?
06/20/2018 at 7:08 AM #7372206/20/2018 at 8:51 PM #73827 -
AuthorPosts
Viewing 12 posts - 1 through 12 (of 12 total)
Find exclusive trading pro-tools on
Similar topics: