rvaidyamath
New member
Hello there I need help on help with code.... i tried to put on thinkorswim platform.. not much of luck
I get the repeated Buy followed by buy as conditions are met and ; i don't want to display the same condition unless its different condition....
#Begin Code
# HA area
def o = open;
def c = close ;
def h = high;
def l = low;
def HAopen = CompoundValue(1, (o[1] + c[1]) / 2, (o[1] + c[1]) / 2);
def HAclose = (o + h + l + c) / 4;
def HAhigh = Max(Max(h, haopen), haclose);
def HAlow = Min(Min(l, haopen), haclose);
def HA_green = if HAclose > HAopen then 1 else 0;
def HA_red = if HAclose < HAopen then 1 else 0;
def HA_neutral = if HAclose == HAopen then 1 else 0;
def BuyHA_cond = if HA_green == 1 and HA_green[1] == 1 then 1 else 0;
def SellHA_cond = if HA_red == 1 and HA_red[1] == 1 then 1 else 0;
#Buy plot
plot BuyHA = if BuyHA_cond == 1 and BuyHA_cond[1] != BuyHA_cond
then low else Double.NaN;
BuyHA.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
BuyHA.SetLineWeight(5);
BuyHA.SetDefaultColor(Color.Green);
#Alert( BuyHA, " ", Alert.BAR, Sound.Chimes);
AddChartBubble( BuyHA , open , "Buy :" + open[0], Color.green, yes);
AddLabel( BuyHA , "Buy", color.green);
#Sell plot
plot SellHA = if SellHA_cond == 1 and SellHA_cond[1] != SellHA_cond
then low else Double.NaN;
SellHA.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
SellHA.SetLineWeight(5);
SellHA.SetDefaultColor(Color.RED);
#Alert( SellHA, " ", Alert.BAR, Sound.Chimes);
AddChartBubble( SellHA , CLOSE , "Sell :" + open[0], Color.red, yes);
AddLabel( SellHA , "Sell", color.green);
# End of code
I get the repeated Buy followed by buy as conditions are met and ; i don't want to display the same condition unless its different condition....
#Begin Code
# HA area
def o = open;
def c = close ;
def h = high;
def l = low;
def HAopen = CompoundValue(1, (o[1] + c[1]) / 2, (o[1] + c[1]) / 2);
def HAclose = (o + h + l + c) / 4;
def HAhigh = Max(Max(h, haopen), haclose);
def HAlow = Min(Min(l, haopen), haclose);
def HA_green = if HAclose > HAopen then 1 else 0;
def HA_red = if HAclose < HAopen then 1 else 0;
def HA_neutral = if HAclose == HAopen then 1 else 0;
def BuyHA_cond = if HA_green == 1 and HA_green[1] == 1 then 1 else 0;
def SellHA_cond = if HA_red == 1 and HA_red[1] == 1 then 1 else 0;
#Buy plot
plot BuyHA = if BuyHA_cond == 1 and BuyHA_cond[1] != BuyHA_cond
then low else Double.NaN;
BuyHA.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
BuyHA.SetLineWeight(5);
BuyHA.SetDefaultColor(Color.Green);
#Alert( BuyHA, " ", Alert.BAR, Sound.Chimes);
AddChartBubble( BuyHA , open , "Buy :" + open[0], Color.green, yes);
AddLabel( BuyHA , "Buy", color.green);
#Sell plot
plot SellHA = if SellHA_cond == 1 and SellHA_cond[1] != SellHA_cond
then low else Double.NaN;
SellHA.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
SellHA.SetLineWeight(5);
SellHA.SetDefaultColor(Color.RED);
#Alert( SellHA, " ", Alert.BAR, Sound.Chimes);
AddChartBubble( SellHA , CLOSE , "Sell :" + open[0], Color.red, yes);
AddLabel( SellHA , "Sell", color.green);
# End of code