You can make your own input for choices. Here is an input pricex which lists multiple price choices. A switch statement then include all of those choices (mandatory). You can add more if you want.
You can use price in your code based upon the choice made. Please note that parameters such as those with math symbols must be in quotes.
You can use price in your code based upon the choice made. Please note that parameters such as those with math symbols must be in quotes.
Ruby:
input pricex = {default close, open, high, low, hl2, ohlc4, "open+close/2", "open+high+low/3"};
def price;
switch (pricex) {
case close:
price = close;
case open:
price = open;
case high:
price = high;
case low:
price = low;
case hl2:
price = hl2;
case ohlc4:
price = ohlc4;
case "open+close/2":
price = (open + close) / 2;
case "open+high+low/3":
price = (open + high + low) / 3;
}
AddLabel(1, price);
Last edited by a moderator: