Mua/Bán trong ngày

Tác giả:ChaoZhang, Ngày: 2022-05-25 17:44:23
Tags:RSISMA

BUY & SELL Scalp Signals for Crude Oil Future Contracts (hoặc nó có thể được sử dụng với bất kỳ bản ghi nào có khối lượng khối lượng tốt) dựa trên báo động mua quá nhiều / bán quá nhiều của Sma & RSI (!) để chỉ ra khả năng đảo ngược.

Lấy vị trí mua chỉ khi nến phá vỡ mức cao của nến cảnh báo & cho các vị trí bán, lấy vị trí nếu nến phá vỡ thấp của nến cảnh báo.

Tốt nhất để thực hiện với khung thời gian 3 phút trên dầu thô tương lai

backtest

img


/*backtest
start: 2022-04-24 00:00:00
end: 2022-05-23 23:59:00
period: 4h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © nicks1008

//@version=4
study(title="CRUDE OIL BUY/SELL",shorttitle="CRUDE Scalp |3 Min",precision=2,overlay=true)

Rsi_value=input(14,title="RSI Length",step=1)
hl=input(75,title="Higher Value of RSI",step=1)
ll=input(25,title="Lower value of RSI",step=1)
rs=rsi(close,Rsi_value)

sma_value=input(50,title="SMA Length",step=1)
sma1=sma(close,sma_value)

dist_SMA=1
candle_length=1

mycolor= iff(rs>=hl or rs<=ll,color.yellow,iff(low> sma1,color.lime,iff(high<sma1,color.red,color.yellow)))
gaps=sma1+dist_SMA  //Gap between price and SMA for Sell
gapb=sma1-dist_SMA  //Gap between price and SMA for Buy
chartgap=gaps or gapb  //for both below or above the SMA 
gap1=sma1+5
gapvalue=(open/100)*candle_length     //setting % with its Share price
gapp=(high-low)>gapvalue //or rs<50     // Condition for Min candle size to be eligible for giving signal - Buy Calls
gapp2=(high-low)>gapvalue //or rs>55    // Condition for Min candle size to be eligible for giving signal - Sell Calls
bull=open<close and (high-low)>2*gapvalue and close>(high+open)/2
bear=open>close and (high-low)>2*gapvalue and close<(low+open)/2


rev1=rs>68 and open>close and open>gaps and (high-low)>gapvalue+0.5 and low!=close      //over red candles  "S" - uptrend
rev1a=rs>90 and open<close and close>gaps and high!=close and open!=low                             // over green candles"S" - uptrend
sellrev= rev1 or rev1a

rev2=rs<50 and open<close and open<gapb and open==low  //over green candles"B"
rev3=rs<30 and open>close and high>gapb and open!=high and barstate.isconfirmed!=bear  //over red candles"B"
rev4=rs<85 and close==high and (high-low)>gapvalue and open<close    //over green candle in both trends
hlrev_s=crossunder(rs,hl)
llrev_b=crossover(rs,ll) and open<close

buycall=open<close and open>sma1 and cross(close[1],sma1) and close>sma1
sellcall=cross(close,sma1) and open>close
BUY=crossover(close[1],sma1) and close[1]>open[1] and high[0]>high[1] and close[0]>open[0]  
SELL=crossunder(low[1],sma1) and close[1]<open[1] and low[0]<low[1] and close[0]<open[0]

plotshape(SELL,title="SELL",style=shape.labeldown,color=color.red,text="S",textcolor=color.black,transp=30)
plotshape(BUY,title="BUY",style=shape.labelup,color=color.aqua,text="B",textcolor=color.black,transp=30,location=location.belowbar)

plotshape(hlrev_s,title="Reversal1",style=shape.labeldown,color=color.yellow,text="!",textcolor=color.black,transp=20)
plotshape(llrev_b,title="Reversal2",style=shape.labelup,color=color.yellow,text="!",textcolor=color.black,transp=20,location=location.belowbar)

plot(sma1,title="SMA",color=mycolor,linewidth=2)
alertcondition(hlrev_s or llrev_b,title="Reversal Signal", message="Reversal Alert")
alertcondition(SELL or BUY,title="Buy/Sale Signal", message="Buy/Sell Alert")

if BUY
    strategy.entry("Enter Long", strategy.long)
else if SELL
    strategy.entry("Enter Short", strategy.short)

Có liên quan

Thêm nữa