Сигналы на покупку и продажу отличаются на свечу относительно графика - PullRequest
0 голосов
/ 15 марта 2020

Я попытался построить график на основе сигналов, которые генерируются из стратегии ниже. Но из сценария я заметил, что точки генерации сигнала отличаются на Свечу . Если кто-нибудь узнает об этом, пожалуйста, помогите мне. Для справки я прикрепил ниже снимки

1. Купить снимок сигнала 2. Продаем сигнальные снимки


//@version=4
strategy("My Strategy", overlay=true)
orderType = 0
longCondition = crossover(sma(close, 14), sma(close, 28))
if (longCondition)
    strategy.entry("My Long Entry Id", strategy.long)
    orderType := 1

shortCondition = crossunder(sma(close, 14), sma(close, 28))
if (shortCondition)
    strategy.entry("My Short Entry Id", strategy.short)
    orderType := -1
plot(orderType,"OrderType",color.black)

Ответы [ 2 ]

1 голос
/ 16 марта 2020
//@version=4
strategy("My Strategy", overlay=true, process_orders_on_close=true)
orderType = 0
longCondition = crossover(sma(close, 14), sma(close, 28))
if (longCondition)
    strategy.entry("My Long Entry Id", strategy.long)
    orderType := 1

shortCondition = crossunder(sma(close, 14), sma(close, 28))
if (shortCondition)
    strategy.entry("My Short Entry Id", strategy.short)
    orderType := -1
plot(orderType,"OrderType",color.black)
1 голос
/ 16 марта 2020
...