Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #
- # Momentum/Trend Alcista o Bajista según @carpatos
- #
- declare lower;
- input length = 14;
- input alcistas = 60;
- input bajistas = 50;
- input price = close;
- input averageType = AverageType.WILDERS;
- input showBreakoutSignals = no;
- plot limite_alcistas = alcistas;
- plot limite_bajistas = bajistas;
- def NetChgAvg = MovingAverage(averageType, price - price[1], length);
- def TotChgAvg = MovingAverage(averageType, AbsValue(price - price[1]), length);
- def ChgRatio = if TotChgAvg != 0 then NetChgAvg / TotChgAvg else 0;
- plot RSI = 50 * (ChgRatio + 1);
- RSI.DefineColor("bajista", GetColor(5));
- RSI.DefineColor("normal", GetColor(7));
- RSI.DefineColor("alcista", GetColor(6));
- RSI.SetPaintingStrategy(PaintingStrategy.Histogram);
- RSI.AssignValueColor
- (
- if RSI[2]>alcistas AND RSI[1]>alcistas AND RSI[0]>alcistas
- then RSI.color("alcista")
- else
- if RSI[2]>alcistas AND RSI[1]>alcistas AND RSI[0]<alcistas
- then RSI.color("alcista")
- else
- if RSI[2]>alcistas AND RSI[1]<alcistas AND RSI[0]>alcistas
- then RSI.color("alcista")
- else
- if RSI[2]<alcistas AND RSI[1]>alcistas AND RSI[0]>alcistas
- then RSI.color("alcista")
- else
- if RSI[2]<bajistas AND RSI[1]<bajistas AND RSI[0]<bajistas
- then RSI.color("bajista")
- else
- if RSI[2]<bajistas AND RSI[1]<bajistas AND RSI[0]>bajistas
- then RSI.color("bajista")
- else
- if RSI[2]<bajistas AND RSI[1]>bajistas AND RSI[0]<bajistas
- then RSI.color("bajista")
- else
- if RSI[2]>bajistas AND RSI[1]<bajistas AND RSI[0]<bajistas
- then RSI.color("bajista")
- else
- RSI.color("normal")
- );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement