Stoploss trigger value set to a minus value what is it doing?
Forums › ProRealTime English forum › ProOrder support › Stoploss trigger value set to a minus value what is it doing?
- This topic has 5 replies, 3 voices, and was last updated 3 years ago by Vonasi.
-
-
06/15/2020 at 3:16 PM #136003
Hi
Stoploss trigger value set to a minus value what is it doing?
I’m currently running and testing this. Using normal values it works as it should, and works particularly well for a eurusd strategy I wrote with different normal integers. However when I put in a negative integer for the stop trigger to move th estop loss I get interesting results but I am unable to ascertain why via graphing.
This is on GBPUSD 7hrs and I’ve put below code to enter on next candle for testing purposes of the stoploss move.
Graphing and graphonprice show this on the 7hr as opening on the new stoploss level of 43, however the backtesting results show significant improvement of stopouts without losing good trades and provide different results entirely to just using a stoploss of 43 by quite a lot, 250pips or so over 16 months.
I’m currently testing this out and have tested on the 1 minute and 5 minutes as well as 10 minutes which show results of moving based on time and on the next bar for 5 or 10 mins or if I recal it was 1 minute on the 5 minute chart with a lesser negative value (memory fails me a bit there), so it can also vary if you change the value to a lower negative value like -10 or -20 say.
I’ve got this up on the 7hr GBPUSD testing to see what it does and screen recording it currently so I can flick through and see at what point it changes and then try to figure out why. I might be missing something obvious but the stoplevel graph reflects the graphonprice levels which is what I would be expecting.
I’ve left it run on the demo 7hr now for over 1 hour and its retained its stoploss of 60pips for the first hour of running and not changed to the new stoploss, so I’m thinking it’s time related somehow otherwise I would have a graph showing 60 dropping to 43 on the next bar if it closed at or past a particular level, which isnt reflected in the graphing. Might take me a few days of recording if I get stopped out and have to await the next candle, in which case I’ll try a stupid initial stoploss and take profit…
Just to note the only change from this working normally is I set the trigger to a negative value of -32 that is “newstoptrigger= -32” in the code
Hopefully someone knows what is happening and I dont have to record for days on end. 🙂
Pic of graph and graphonprice attached as well
Stoploss move12345678910111213141516171819202122232425262728293031323334353637383940414243DEFPARAM CumulateOrders = false//Conditions for long positionc1=(close[1] >=open[1]) //opens long after bullish candle closeIf not onmarket and c1 ThenBuy 1 perpoint at marketendif//conditions to enter short positionsc2=(close[1] <= open[1]) //opens short after bearish candle closeIf not onmarket and c2 thenSellshort 1 perpoint at marketendifstopamount=60 //stopamounttargetamount=125 //targetnewstoplevel=43// value to work out stop level tradeprice + or -newstoptrigger=-32 //pips moved to trigger new stop levelIf longonmarket and (close-tradeprice)>=newstoptrigger thenMystoplevel=(tradeprice-newstoplevel)//sets the vlaue if price gone to or beyond 60 pipsElsif longonmarket and (close-tradeprice)<=newstoptrigger thenMystoplevel=(tradeprice-newstoplevel)Elsif longonmarket thenMystoplevel=(tradeprice-stopamount)//set the value to level to calculate 60 pips//Below setting stoploss for shorts//Elsif shortonmarket and (tradeprice-close)>=newstoptrigger thenMystoplevel=(tradeprice+newstoplevel)Elsif shortonmarket and (tradeprice-close)<=newstoptrigger thenMystoplevel=(tradeprice+newstoplevel)Elsif shortonmarket thenMystoplevel=(tradeprice+stopamount)endifIf longonmarket thenMystoploss=tradeprice-mystoplevel ///changing to pipsElsif shortonmarket thenMystoploss=Mystoplevel-tradeprice//changing to pipsEndifset Stop Loss MystoplossSET TARGET pPROFIT targetamountIf not onmarket thenMystoploss=stopamountEndifGraphonprice Mystoplevel as "Mystoplevel"Graph Mystoploss06/15/2020 at 3:23 PM #136005Looking at my notes there I’m not sure they are current.. best to read the code..- sorry about that,, above code totally wrong one.
Below is current code with the results shown
The code being used123456789101112131415161718192021222324252627282930313233343536373839DEFPARAM CumulateOrders = false//Conditions for long positionc1=(close[1] >=open[1]) //opens long after bullish candle closeIf not onmarket and c1 ThenBuy 1 perpoint at marketendif//conditions to enter short positionsc2=(close[1] <= open[1]) //opens short after bearish candle closeIf not onmarket and c2 thenSellshort 1 perpoint at marketendifstopamount=60 //stopamounttargetamount=125 //targetnewstoplevel=43// value to work out stop level tradeprice + or -newstoptrigger=-32 //pips moved to trigger new stop levelIf longonmarket and (close-tradeprice) >=newstoptrigger thenMystoplevel=(tradeprice-newstoplevel)// sets th elevel fo r stoploss if triggeredElsif longonmarket thenMystoplevel=(tradeprice-stopamount)//set the value to level to calculate 60 pips//Below setting stoploss for shorts//Elsif shortonmarket and (tradeprice-close) >=newstoptrigger thenMystoplevel=(tradeprice+newstoplevel)Elsif shortonmarket thenMystoplevel=(tradeprice+stopamount)endifIf longonmarket thenMystoploss=(tradeprice-mystoplevel) ///changing to pipsElsif shortonmarket thenMystoploss=(Mystoplevel-tradeprice)//changing to pipsEndifset Stop Loss MystoplossSET TARGET pPROFIT targetamountIf not onmarket thenMystoploss=stopamountEndif//Show results on the chart and as a graphGraphonprice Mystoplevel as "Mystoplevel"Graph Mystoploss06/16/2020 at 2:09 PM #136133Well seems like a non starter for solutions, however running it seems to set the new stop at next bar open, so starts with the intial stoploss and moves to new stoploss at next bar. Doesnt explain the programming of it mind or why a lesser value doesnt wait for the next bar. Next bar stoploss move actually gives me better profit on the timeframe used with this strategy, I think because it allows a bit of a foat (7hrs timeframe) so allows additional catches. So I’ll need to code for stoploss at the second bar of trade and see if it produces the same result… now have to work on that unless anyones got a few lines of code of coure… 🙂
06/16/2020 at 2:23 PM #136136I suggest that you also GRPAH all other variables and expressions that may affect results:
- GRAPH TradePrice
- GRAPH tradeprice–newstoplevel
- GRAPH Mystoplevel-tradeprice
- GRAPH close – TradePrice
- GRAPH TradePrice – close
to easily spot any wrong value.
You might use ABS() to make a negative vlue positive, but that would leave the glitch hidden.
06/16/2020 at 3:51 PM #13617506/16/2020 at 9:52 PM #136199Philstrading – there is no need to quote Roberto when he is the only person who has replied to your topic! Unnecessary quoting bloats topics and makes them hard to read for others. Please read the forum rules regarding quoting before using the quote button again. I have deleted your unnecessary quote.
-
AuthorPosts
Find exclusive trading pro-tools on