In the code below I've got a Profit Target label for 2x of previous bar to the upside and downside (on the chart its the far right green and red labels) these are based on the doji bar at 3:55 pm.
When I tried adding a painting strategy it kept flattening all bars and would put a line above each bar. Would someone be able to help me just project the horizontal line
for profit target above the current bar?
The whole cold in general calculates risk off previous bar, quantity of shares based on a dollar amount & profit target of minimum 2x risk.
##Calculate the percentage change of previous bar bar
def percentChange = (high[1] - low[1]) / high[1] * 100;
def valueChange = (high[1] - low[1]) * 2;
def negValueChange = (high[1] - low[1]) * 2;
def profitTarget = (valueChange + high[1] - low[1]);
def profitTarget1 = (high[1] + valueChange);
def bearProfitTarget = negValueChange - high[1] - low[1];
def profitTarget2 = (low[1] - negValueChange);
def sharesTraded = Round( 100000 / close[1], 0);
def sharesTraded1 = RoundUp( 50000 / close[1], 0);
def sharesTraded2 = RoundUp( 20000 / close[1], 0);
##Add a label displaying the percentage value on the current bar
AddLabel(yes, "$100K QTY " + sharesTraded, Color.YELLOW);
AddLabel(yes, "$" + Round(percentChange * 1000, 0), Color.GREEN);
AddLabel(yes, "$50K QTY " + sharesTraded1, Color.YELLOW);
AddLabel(yes, "$" + Round(percentChange * 500, 0), Color.GREEN);
AddLabel(yes, "$20K QTY " + sharesTraded2, Color.YELLOW);
AddLabel(yes, "$" + Round(percentChange * 200, 0), Color.GREEN);
AddLabel(yes, "Profit Target " + profitTarget1, Color.GREEN);
AddLabel(yes, "Profit Target " + profitTarget2, Color.RED);
Thank you
When I tried adding a painting strategy it kept flattening all bars and would put a line above each bar. Would someone be able to help me just project the horizontal line
for profit target above the current bar?
The whole cold in general calculates risk off previous bar, quantity of shares based on a dollar amount & profit target of minimum 2x risk.
##Calculate the percentage change of previous bar bar
def percentChange = (high[1] - low[1]) / high[1] * 100;
def valueChange = (high[1] - low[1]) * 2;
def negValueChange = (high[1] - low[1]) * 2;
def profitTarget = (valueChange + high[1] - low[1]);
def profitTarget1 = (high[1] + valueChange);
def bearProfitTarget = negValueChange - high[1] - low[1];
def profitTarget2 = (low[1] - negValueChange);
def sharesTraded = Round( 100000 / close[1], 0);
def sharesTraded1 = RoundUp( 50000 / close[1], 0);
def sharesTraded2 = RoundUp( 20000 / close[1], 0);
##Add a label displaying the percentage value on the current bar
AddLabel(yes, "$100K QTY " + sharesTraded, Color.YELLOW);
AddLabel(yes, "$" + Round(percentChange * 1000, 0), Color.GREEN);
AddLabel(yes, "$50K QTY " + sharesTraded1, Color.YELLOW);
AddLabel(yes, "$" + Round(percentChange * 500, 0), Color.GREEN);
AddLabel(yes, "$20K QTY " + sharesTraded2, Color.YELLOW);
AddLabel(yes, "$" + Round(percentChange * 200, 0), Color.GREEN);
AddLabel(yes, "Profit Target " + profitTarget1, Color.GREEN);
AddLabel(yes, "Profit Target " + profitTarget2, Color.RED);
Thank you