//@version=5
strategy("我的策略", overlay=true, margin_long=100, margin_short=100)
//----------settings----------//
minGap = input.float(0.01, 'Minimum FVG %')//, minval = .01, step = .01, inline = '2')
bullishFVG = low > high【2】 and close【1】 > high【2】 and ((low - high【2】) / high【2】) > minGap
bearishFVG = high < low【2】 and close【1】 < low【2】 and ((low【2】 - high) / high) > minGap
aaa = input(2,title = "高低点")
aaaa = input(20,title = "高低点")
aa = ta.lowest(aaa)
bb = ta.highest(aaaa)
cc=ta.lowest(aaaa)
dd=ta.highest(aaa)
rr=input(1.3)
ee=input(30)
longCondition = bullishFVG
if (longCondition)// and (close-aa)*2<(bb-close)
strategy.entry("long", strategy.long,limit = close, qty = ee/(close-aa))
strategy.exit("exit","long",qty_percent = 50,stop = aa,limit=close+(close-aa))
strategy.exit("买exit", "long",stop=aa, limit=close+(close-aa)*rr) // 设置止损和止盈