mbarcala
Active member
I trying to create a switch as a part of my indicator
https://usethinkscript.com/threads/break-price-momentum-bpm-for-thinkorswim.9453/
, some help here please?
https://usethinkscript.com/threads/break-price-momentum-bpm-for-thinkorswim.9453/
, some help here please?
Code:
input reverType = {default detrendOne, detrendTwo};
############### Posible Price Reversals ################
plot trendUp = if BPM > centlev and BPM crosses above BPM[1] then BPM + -0.1 else Double.NaN;
trendUp.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
trendUp.SetDefaultColor(Color.WHITE);
trendUp.SetLineWeight(1);
trendUp.HideBubble();
trendUp.HideTitle();
plot trendDn = if BPM < -centlev and BPM crosses below BPM[1] then BPM + 0.1 else Double.NaN;
trendDn.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
trendDn.SetDefaultColor(Color.WHITE);
trendDn.SetLineWeight(1);
trendDn.HideBubble();
trendDn.HideTitle();
############## Possible Exit Levels #################
def extValue = if BPM >= exitLevelBeg then RoundDown((BPM - exitLevelBeg) / calDays, 0) + 1 else if BPM <= -exitLevelBeg then RoundDown((-exitLevelBeg - BPM) / calDays, 0) + 1 else 0;
plot exts = if extValue > 0 and extValue[1] != extValue then BPM else Double.NaN;
exts.SetPaintingStrategy(PaintingStrategy.POINTS);
exts.SetDefaultColor(Color.MAGENTA);
exts.SetLineWeight(3);
exts.HideBubble();
exts.HideTitle();
############## Multi Revertion Points #################
plot upBuy = if flen crosses above flen[1] and !IsNaN(close) then flen[1] else Double.NaN;
upBuy.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
upBuy.SetDefaultColor(Color.MAGENTA);
upBuy.SetLineWeight(1);
plot dnSell = if flen crosses below flen[1] and !IsNaN(close) then flen[1] else Double.NaN;
dnSell.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
dnSell.SetDefaultColor(Color.MAGENTA);
dnSell.SetLineWeight(1);
switch (reverType) {
case detrendOne:
Posible Price Reversals should go here
Possible Exit Levels should go here
case detrendTwo:
Multi Revertion Points should go here
}
Last edited by a moderator: