有没有办法在笔录中记录下你在哪根蜡烛上停了下来或失去了一笔交易?我的战略有四个方面:
我想添加另一个状态,告诉我我刚刚被叫停,并根据这个状态对下一步我的策略做出不同的决定。
发布于 2021-07-07 15:30:10
如果我对你的理解正确,你就会发现亏损的交易。下面是一个例子:
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © adolgov
//@version=4
strategy("My Strategy", overlay=true, margin_long=100, margin_short=100)
longCondition = crossover(sma(close, 14), sma(close, 28))
if (longCondition)
strategy.entry("My Long Entry Id", strategy.long)
shortCondition = crossunder(sma(close, 14), sma(close, 28))
if (shortCondition)
strategy.entry("My Short Entry Id", strategy.short)
if strategy.netprofit[1] > strategy.netprofit
label.new(bar_index, low, text = str.format("here is losing trade with size {0} {1}", strategy.netprofit - strategy.netprofit[1], syminfo.currency) )https://stackoverflow.com/questions/68276592
复制相似问题