[英]find out how many short and long signals were
如何在表格中顯示特定時期內的多頭和空頭交易數量? 我用這個功能試過了
tostring(barssince(long and window()))
window() 在哪里 - 策略開始的時間間隔我需要編寫一個代碼來顯示有多少多頭交易和多少空頭交易,例如這樣
longSignals = 147
ShortSignals = 153
TotalSignals = 300
將其存儲到變量中
//@version=4
strategy("My Strategy", overlay=false)
long = bar_index< 100 and (bar_index %2==0)
longclose = bar_index< 100 and (bar_index %2!=0)
window = bar_index > 50
var long_entries = 0
var short_entries = 0
if long
strategy.entry("EN", strategy.long)
if (window)
long_entries += 1
if longclose
strategy.entry("EN", strategy.short)
if (window)
short_entries += 1
var testTable = table.new(position = position.top_right, columns = 2, rows = 1, bgcolor = color.yellow, border_width = 1)
if barstate.islastconfirmedhistory
table.cell(table_id = testTable, column = 0, row = 0, text = "Long " + tostring(long_entries))
table.cell(table_id = testTable, column = 1, row = 0, text = "Short " + tostring(short_entries), bgcolor=color.teal)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.