08-25-2019, 09:35 PM
(08-24-2019, 11:14 AM)PGTART Wrote: I extended a known script called: RSI_BULL_BEAR_ADX
In such a way that it has two stoploss settings, one for Bull and one for Bear markets.
However now i am wondered about generic stoploss math, as in other strategies.
Most of the times i see some percentage of the last long candle close buy to not go below that.
Sometimes i see people using a stoploss with a fixed amount, say 50 dollar or so, since last long candle close.
But i'm wondered I could also code to memorize the highest and lowest candle stops - since - my last long bu advice.
So create a stoploss that would stop after the highest values since my last buy would drop more then a certain percentage
I dont know enough of the background ideas behind RSI_BULL_BEAR_ADX if that would make sense or not.
And am worried if that would be an antipatten to code in regards to the ADX part of it.
What do you people think of alternative stoploss rules ?
And maybe you know of perhaps more afvanced stoploss rules ?
perhaps nice to see some logging of the not yet ready code as want validate it a bit more first :
I log to console:
Bear long at 9592 stoploss: bear<9113 bull< (misssing) // missing is bug
Bear short
Bull long at 9883 stoploss: bear<9389 bull<9834 // after each long i recalculate bot stoplosslevels so i can swing from bear/bull markets
Bull stoploss triggered on 9775 Bullstop was 9786
Bull long at 10450 stoploss: bear<9928 bull<10398
Bull stoploss triggered on 10483 Bullstop was 10537
Bull long at 10564 stoploss: bear<10036 bull<10511
Bull stoploss triggered on 10501 Bullstop was 10511
Bull long at 10838 stoploss: bear<10296 bull<10783
Bull stoploss triggered on 10777 Bullstop was 10848 //interesting making profit from bull to bear market.
Bear long at 9673 stoploss: bear<9189 bull<(missing)
Bear short
oh well it wasnt that difficult to extend my code just going to test :
Code:
if (this.price>this.maxcandleclose) //lifting the bearstop to last highest
{
this.maxcandleclose=candle.close;
this.BEARSTOP = this.price - (this.price * this.BEAR_STOP_LOSS);
this.BULLSTOP = this.price - (this.price * this.BULL_STOP_LOSS);
}
BTW it works quite well, beeing able to have different stoplosses for bear and bull markets.