APIBridge Advanced RSI + EMAUsing Pinescript, we will use charts of Cash/Future to trade in Options. Note this strategy works well with even the free version of TradingView.
The Relative Strength Index ( RSI ). Is a momentum oscillator that measures the speed and change of price movements. The RSI oscillates between zero and 100. Increasing RSI shows increasing bullish momentum. Decreasing RSI shows increasing bearish momentum. We take RSI upper bound as 80 to indicate bullish momentum and RSI lower bound as 20 to indicate bearish momentum.
Since this strategy uses underlying data (cash/future) to place trades in Options, please ignore the backtest of this strategy given by TradingView. TradingView does not provide options data but this strategy bypasses it.
Strategy Premise
The Relative Strength Index ( RSI ) is a momentum oscillator that measures the speed and change of price movements. The RSI oscillates between zero and 100. Increasing RSI shows increasing bullish momentum. Decreasing RSI shows increasing bearish momentum. We take RSI upper bound as 80 to indicate bullish momentum and RSI lower bound as 20 to indicate bearish momentum.
apibridge rsi + ema options / futures / commodity algo strategy logic
Long Entry: When RSI crosses over oversold level and fast ema crosses over slow ema , send LE .
Long Exit: When price hit Stop loss or Target .If SL/ TGT is not hit and reverse signal is sent by strategy then exit the Long
Short Entry : When RSI crosses under overbought level and fast ema crosses under slow ema , send SE
Short Exit : When price hit Stop loss or Target. If SL/ TGT is not hit and reverse signal is sent by strategy then exit Short
TradingView Parameters
1. Start Date(Mandatory) : The strategy does not take trade before this date
2. End Date(Mandatory) : The strategy does not take trade after this trade
3.RSI Length(Mandatory): Number of bars used to calculated RSI .
4.Fast Ema Length(Mandatory): Length for fast ema
5.Slow Ema Length(Mandatory): Length for slow ema
6.Source for rsi and ema calculation(Mandatory): Source to use for rsi and ema like close , open , high , low , hl2 etc
7.Overbought(Mandatory): To specify upper band of RSI .
8.Oversold(Mandatory): For specifying lower band of RSI .
9.plot ema or rsi (Mandatory) : Due to difference in scales of rsi and ema , strategy can only plot one of both precisely (the strategy logic which is based on both esi and ema is unaffected by this choice)
10.Quantity: We use this to specify the trade quantity (for Nifty min 75)
11.Custom Stop Loss in Points: Movement in chart price against the momentum which will trigger exit in options positions
12.Custom Target in Points: Movement in chart price against the momentum which will trigger exit in options positions
13.Base symbol: This is the base instrument symbol like NIFTY or BANK NIFTY .
14.Strike distance from ATM: Our default strike selection is considered as first ATM option (with nearest distance, only 100s are considered ). This strike
distance allows to calculate ATM options which are at fixed distance.
15.Expiry: Expiry of option. Weekly and monthly both expiry are allowed.
16.Instrument: For index instrument will be OPTIDX, for stock instrument will be OPTSTK
17.Strategy Tag: The Strategy of Nifty options configured in Api bridge.
Apibridge
APIBridge support and resistance strategy for NSE OptionsStrategy Premise:
The strategy works on the Support and Resistance . The user specifies the trigger price and the strategy will open trades as soon as the market closes after crossing the trigger price. The stoploss and target is compulsory and the trades will close if either the target or stoploss is hit or Intraday end session is reached in case of MIS (Intraday settings) or expiry is reached .
If the positional settings (NRML) has been chosen then the trades will close when either stoploss or target hits or expiry is reached
==========Consecutive trades==========
The strategy takes a long entry on call long put short setting and a short position on put long and call short settings so call long and put short entries can be taken one after another without the need of closing the one of them. Similarly put long and call short can be taken one after another.
But put long and call short can not be taken one after another with both the trades open because on tradingview closes the previous long or short when we take short or long respectively. Similarly call long and put short can not be taken one after another with both the trades open
Create Alert
Simply copy the text written in Alert Message field on the top of input section and replace everything in the message box of the alert with this text
Strategy Parameters
1. Alert Message : Copy the string in the input field and replace with the text in the message box of the alert to get the automated trades
2. Use Backtesting : Check this box to use the backtesting parameters . The backtesting parameters will only show trades between the specified intervals
3. Starting Date and Time : The strategy will only place trades after this time according to logic
4. Ending Date and Time : The strategy willonly place trades before this time according to logic
5. Segment Type : Choose the segment type . MIS is Intraday and NRML is normal cash and carry/Positional
6. Start Session : This is the session in which the strategy will take entry according to logic every day . This parameter works only with MIS and not NRML
7. Ending Session : This is the session which will square off all the open trades . This parameter works only with MIS and not NRML
8. Long : Check this box for Long/Buy Positions
9. Long Price : This is the trigger price , the strategy will Long/Buy when the price closes after crossing this line.
10. Call or Put on Long : Choose whether you want to Long/Buy Call or Put
11. Stoploss and Target type for Long : Choose from the given types
12. Long Target : specify the target
13. Stoploss Value for Long : Specify the stoploss value
14. Use TSL : Check this to use trailing stoploss
15. ATR settings : Set the atr settings to use atr based stoploss
16. Short : Check this to Short/Sell
17. Short Price : This is the trigger price , the strategy will Long/Buy when the price closes after crossing this line.
18. Call or Put on Short: Choose whether you want to Long/Buy Call or Put
19. Stoploss and Target type for Short: Choose from the given types
20. Short Target : specify the target
21. Stoploss Value for Short: Specify the stoploss value
22. Use TSL : Check this to use trailing stoploss
23. ATR settings : Set the atr settings to use atr based stoploss
24. Instrument Type : Choose the option type
25. Expiry Settings : Configure the expiry date . the strategy will not take entry after expiry
26. Symbol : Specify Symbol name if want to trade in symbol other than current chart symbol
27. Strike Type/Money Type : select the money type
28. Strike Difference : Enter the difference between the two consecutive strikes of the choosen asset
29. Strike Distance from ATM : Enter the distance of strike from ATM which you want to buy in any strike type/money type . If zero has been choosen in case of OTM/ ITM then the strike dif will used as default
30. Quantity : Specify the number of lots you want to trade
31. Strategy Tag : Specify the strategy tag you wan to use with APIBRIDGE . If left blank it will trade in the strategy tag fed in the APIBRIDGE
APIBridge Candlestick Reversal SystemStrategy Premise
This strategy uses the Wick Reversal System introduced in Pivot Boss and generates signals based on Candlestick Patterns.
– Wick Reversal System
– Extreme Reversal System
– Outside Reversal System
– Doji Reversal System
Wick Reversal System:
1. For a Bullish reversal wick to exist, the close of the bar should fall within the top 35% of the overall range of the candle.
2. For a bearish reversal wick to exist, the close of the bar should fall within the bottom 35% of the overall range of the candle.
Extreme Reversal System:
1. The first bar of the pattern is about two times larger than the average size of the candles in the look-back period.
2. The body of the first bar of the pattern should encompass more than 50% of the bar’s total range, but usually not more than 85%.
3. The second bar of the pattern opposes the first. If the first bar of the pattern is bullish (C > 0), then the second bar must be bearish (C < 0). If the first bar is bearish (C < 0), then the second bar must be bullish (C > 0).
Outside Reversal System:
1. The Engulfing bar of a bullish outside reversal setup has a low that is below the prior bar’s low (L < L) and a close that is above the prior bar’s high (C > H).
2. The Engulfing bar of a bearish outside reversal setup has a high that is above the prior bar’s high (H > H) and a close that is below the prior bar’s low (C < L).
3. The Engulfing bar is usually 5 to 25 percent larger than the size of the average bar in the look-back period.
Doji Reversal System:
1. The open and close prices of the Doji should fall within 10 percent of each other, as measured by the total range of the Candlestick .
2. For a Bullish Doji , the high of the Doji Candlestick should be below the ten-period Simple Moving Average (H SMA (10)).
4. For a Bearish Doji , one of the two bars following the Doji must close beneath the low of the Doji (C < L or C < L).
5. For a Bullish Doji setup, one of the two bars following the Doji must close above the high of the Doji (C > H) or C > H)
Strategy Logic
Long Entry:
When Low Pivot Point and Wick Reversal System and Bullish Wick Reversal Setup Pattern Send, LE
OR When Low Pivot Point and Extreme Reversal System and Bullish Extreme Reversal setup Send ,LE
OR When Low Pivot Point and Outside Reversal System and Bullish Outside Reversal Setup Send LE
OR When Low Pivot Point and Doji Reversal System and Bullish Doji Reversal Setup Send, LE
Long Exit:
Either when SL or Target is hit. If SL/ TGT is not hit and
When High Pivot Point and Wick Reversal System and Bearish Wick Reversal Setup Pattern Send LXSE
OR When High Pivot Point Extreme Reversal System and Bearish Extreme Reversal setup Send LXSE
OR When High Pivot Point Outside Reversal System and Bearish Outside Reversal Setup Send LXSE
OR When High Pivot Point Doji Reversal System and Bearish Doji Reversal Setup Send, LXSE
Short Entry:
When High Pivot Point and Wick Reversal System and Bearish Wick Reversal Setup Pattern Send SE
OR When High Pivot Point Extreme Reversal System and Bearish Extreme Reversal setup Send SE
OR When High Pivot Point Outside Reversal System and Bearish Outside Reversal Setup Send SE
OR When High Pivot Point Doji Reversal System and Bearish Doji Reversal Setup Send, SE
Short Exit:
Either when SL or Target is hit. If SL/ TGT is not hit and
When Low Pivot Point and Wick Reversal System and Bullish Wick Reversal Setup Pattern Send, SXLE
OR When Low Pivot Point and Extreme Reversal System and Bullish Extreme Reversal setup Send ,SXLE
OR When Low Pivot Point and Outside Reversal System and Bullish Outside Reversal Setup Send SXLE
OR When Low Pivot Point and Doji Reversal System and Bullish Doji Reversal Setup Send, SXLE
Candlestick Reversal System Algo Strategy Parameters for TradingView Charts
1.Length: This is number of bars used to calculated Ex: 14 à previous 14 candles are used
2.Backtesting : Use this to backtest the strategy between Starting and Ending Date and time , it can also be used to set trades in future time
3.Alert_Message : Need to copy while creating alert into Message Box
4.Trade Setup : Intraday / Positional (Selecct accordingly)
5.Start Time Stop Time (Session 1) : Intraday / Positional start time and end time of trade for session 1
6.End Session 1 : Define time to exit any existing position taken in session 1 so that exchange charges will not apply
7.Use Second Session : Check this to use second intraday session
8.Start Time Stop Time (Session 2) : Intraday / Positional start time and end time of trade for session 2
9.End Session 1 : Define time to exit any existing position taken in session 2 so that exchange charges will not apply
10.Use Target : check if you want to set required target if not cheque will not applicable
11.Use StopLoss : Cheque if you want to set stop loss if not cheque will not applicable
12.Trailling Stoploss : Cheque if you want to set trailing stop loss if not cheque will not applicable
13.Point Or Percentage For TG SL : Use Points or Percentage as per your choice
14.Target : Set as per the selection of (Point Or Percentage For TG SL)
15.Stop Loss : Set as per the selection of (Point Or Percentage For TG SL)
16.TSL_Type : Select as per your logic in %/ATR/Points
17.TSL_Input : Set in case you select %/Points in TSL_Type
18.ATR Length : Set as per your logic if you select ATR in the field of TSL_Type
19.ATR_Mult : Set as per your logic if you select ATR in the field of TSL_Type
20.Segment : Select segment of your logic EQ/FUTIDX/FUTSTK/OPTIDX/OPTSTK/FUTCUR/FUTCUM (Used in case of option / Futures )
21.Select Expiry Date : Select the expiry date of your trade as per the segment you selected (Used in case of option / Futures )
22.Select Expiry Month : Select the expiry Month of your trade as per the segment you selected (Used in case of option / Futures )
23.Year : Select the expiry Year of your trade as per the segment you selected (Used in case of option / Futures )
24.Quantity : Enter the quantity in which you want to trade (Used in case of option / Futures )
25.Product Type : Select MIS/Normal/ CNC as per your logic (Used in case of option / Futures )
26.Order Type : Select Market/Limit as per your logic (Used in case of option / Futures )
27.Strategy Tag : Enter the value in case you are using webhook / advance template in APIBridgeTM
28.Lotsize : Enter the lotsize as per your lotic and quentity selection (Used in case of option / Futures )
29.STEP (OTM/ATM/ ITM ) : Select OTM(+1)/ATM(0)/ ITM (-1) as per your logic works in case of options only
30.DIFFERENCE_BETWEEN 2 STRIKE : Select difference of 2 strikes you have used in APIBridge symbol setting list, like for Nifty 50 BankNifty 100
31.APIB Port : Set as per provided to you by Algoji in case of webhook / advance templet
The Segment full form is given below
EQ Equity
FUTIDX Future Index
FUTSTK Future Stock
OPTIDX Index Option
OPTSTK Stock Option
FUTCUR Futcur Currency
FUTCUM Future Commodity
APIBridge Nifty Options Algo StrategyUsing Pinescript, we will use charts of Cash/Future to trade in Options. Note this strategy works well with even the free version of TradingView.
The Relative Strength Index ( RSI ). Is a momentum oscillator that measures the speed and change of price movements. The RSI oscillates between zero and 100. Increasing RSI shows increasing bullish momentum. Decreasing RSI shows increasing bearish momentum. We take RSI upper bound as 80 to indicate bullish momentum and RSI lower bound as 20 to indicate bearish momentum.
We use the above premise to create options buy-only strategy which trades in ATM strikes by default. This strategy requires very less margin (Minimum Rs . 15000).
Since this strategy uses underlying data (cash/future) to place trades in Options, please ignore the backtest of this strategy given by TradingView. TradingView does not provide options data but this strategy bypasses it.
Strategy Premise
The Relative Strength Index (RSI) is a momentum oscillator that measures the speed and change of price movements. The RSI oscillates between zero and 100. Increasing RSI shows increasing bullish momentum. Decreasing RSI shows increasing bearish momentum. We take RSI upper bound as 80 to indicate bullish momentum and RSI lower bound as 20 to indicate bearish momentum.
We use the above premise to create options buy-only strategy which trades in ATM strikes by default. This strategy requires very less margin (Rs. 15000 should be sufficient).
NSE Options Algo Strategy Logic
Long Entry: When RSI goes above 80, send LE in an auto-calculated option strike Call. When RSI goes below 20, send LE in auto-calculated option strike Put.
Long Exit: When we hit Stop loss or Target. In case SL/TGT does not hit and reverse RSI goes above 80 send Long Exit in auto-calculated option. Put as per last trade; RSI goes below 20, send LX in auto-calculated option call as per last trade.
For Long and Short entry the order is fired in the option buying side with auto strike price selection.
Option Strategy Parameters for TraingView Charts
RSI Length(Mandatory): Number of bars used to calculated RSI.
Upper Band(Mandatory): To specify upper band of RSI.
Lower Band(Mandatory): For specifying lower band of RSI.
Use reversal from Upper Band (Optional): This will enable short entry when RSI is falling below 80 from upper band. Recommended to keep unchecked initially.
Use reversal from Lower Band (Optional): This will enable long entry when RSI is raising above 20 from lower band. Recommended to keep unchecked initially.
Quantity: We use this specify the trade quantity (for Nifty min 75)
Custom Stop Loss in Points: Movement in chart price against the momentum which will trigger exit in options positions
Custom Target in Points: Movement in chart price against the momentum which will trigger exit in options positions
Base symbol: This is the base instrument symbol like NIFTY or BANK NIFTY.
Strike distance from ATM: Our default strike selection is considered as first ATM option (with nearest distance, only 100s are considered ). This strike distance allows to calculate ATM options which are at fixed distance.
Expiry: Expiry of option. Weekly and monthly both expiry are allowed.
Instrument: For index instrument will be OPTIDX, for stock instrument will be OPTSTK
Strategy Tag: The Strategy of Nifty options configured in Api bridge.
Setting Up Alert
Before setting up the alert make sure that you have selected desired script, time frame, strategy settings, and APIbridge configuration. Click in settings add alert and paste {{strategy.order.comment}} in message box.
Important: Do not change any settings during live trading. It may break the sequence of exit for the correct call/put.