IQOption 脚本 |四码

问题描述 投票:0回答:2

我有一个 iqoption 脚本(quadcode,https://quadcode-tech.github.io/quadcodescript-docs),如果满足某些 ema 和 hist 函数,例如,如果 ema > a hist,则使所有蜡烛满足此条件的蜡烛会变红,并且 90% 的情况下,每当蜡烛变红或变绿时,它至少还有 1 或 2 个相同颜色的蜡烛。我所做的是实现一个带有plotshape 的信号系统,指示何时买入和何时卖出。正如我之前告诉过你的,每当一根蜡烛变成某种颜色时,下一根蜡烛就会跟随该蜡烛的趋势。例如,如果蜡烛变红,那么下一支蜡烛通常也会变红。我遇到的问题是,每次蜡烛变成红色或绿色时,我都会让指标生成卖出或买入信号,因为下一支蜡烛通常是相同的颜色,我想要的是不要在所有蜡烛上生成信号趋势。我希望它仅绘制在由指标绘制的条形趋势中的第一根蜡烛上。

enter image description here


instrument {
    name = 'ETM PROFIT',
    short_name = 'ETM',
    icon = 'https://etmtradingbucket.s3.amazonaws.com/public/logo.png',
    overlay = true
}

Signal_period = input(5,"VIP | Signals Period",input.integer,1,1000,1)

input_group {
    "Compra Proxima vela",
    colorBuy = input { default = "green", type = input.color }, 
    visibleBuy = input { default = true, type = input.plot_visibility }
}

input_group {
    "Venda Proxima vela",
    colorSell = input { default = "red", type = input.color },
    visibleSell = input { default = true, type = input.plot_visibility }
}

input_group {
    "MACD",
    "Slow and fast EMA periods, used in MACD calculation",
    fast = input (12, "front.platform.fast period", input.integer, 1, 250),
    slow = input (26, "front.platform.fast period", input.integer, 1, 250)
}
input_group {
    "front.platform.signal-line",
    "Reference signal series period",
    signal_period = input (9, "front.period", input.integer, 1, 250)
}
input_group {
    "front.newind.emaperiod",
    ema_period = input (13, "front.period", input.integer, 1, 250)
}
input_group {
    "front.newind.barcolors",
    positive = input { default = "#2CAC40",   type = input.color },
    neutral  = input { default = "#C7CAD1", type = input.color },
    negative = input { default = "#DB4931",   type = input.color },
}
fastMA = ema(close, fast)
slowMA = ema(close, slow)
macd = fastMA - slowMA
signal = sma(macd, signal_period)
hist = macd - signal
ema13 = ema (close, ema_period)
local bar_color
        
    if ema13 > ema13 [1] and hist > hist [1] then
    bar_color = positive
elseif ema13 < ema13 [1] and hist < hist [1] then
    bar_color = negative
else
    bar_color = neutral
end
plot_candle (open, high, low, close, "ES", bar_color)
buyCondition = conditional(ema13 > ema13 [1] and hist > hist [1])

sellCondition = conditional(ema13 < ema13 [1] and hist < hist [1])

            plot_shape(
                (buyCondition),
                "",
                shape_style.triangleup,
                shape_size.huge,    
                colorBuy,    
                shape_location.belowbar,
                0,
               "RX-Buy",
                "pink"
               ) 

          plot_shape(
              (sellCondition),
                "ENTER",
                shape_style.triangledown,
                shape_size.huge,
                colorSell,
                shape_location.abovebar,
                0,
                "RX-Sell",
                "salmon"
          )

我遇到的问题是,每次蜡烛变成红色或绿色时,我都会让指标生成卖出或买入信号,因为下一根蜡烛通常是相同的颜色,我想要的是不要在所有蜡烛上生成信号在趋势中。我希望它仅绘制在由指标绘制的条形趋势中的第一根蜡烛上。

trading
2个回答
0
投票

'使用nan。

drop_plot_value('我不想要', current_bar_id) drop_plot_value('我不这么认为', current_bar_id) drop_plot_value('我不这样做', current_bar_id)`


0
投票

Hola pudiste acomodar el Script。 Es que quierop usarlo

© www.soinside.com 2019 - 2024. All rights reserved.