Login Page - Create Account

Support Board


Date/Time: Tue, 26 Nov 2024 06:48:43 +0000



[User Discussion] - Nasdaq total view with IB chart trading

View Count: 2482

[2022-02-08 12:54:28]
UserAR - Posts: 64
I use a linked quote board to my charts and trade directly from the chart DOM. The only way I've found to be able to use NQTV and send trades to IB is by using the attached example. This works fine for static charts but is there a programmatic way I can do this so when I switch between symbols the underlying trade symbol updates? Thanks
imageappl example.PNG / V - Attached On 2022-02-08 12:53:33 UTC - Size: 6.5 KB - 295 views
[2022-02-08 16:24:59]
1+1=10 - Posts: 270
I'm assuming SC doesn't have a built-in way to do this so I created a custom study. It took me 5 minutes and it is something I may use myself in the future when trading equities. It only translates SC symbols that end in -NQTV so it won't modify your non-equity trade symbols.

You can either take the source code below, copy it to a file ending in .cpp, and compile the code into a study yourself yourself following the rather involved instructions here: How to Build an Advanced Custom Study from Source Code: Step-By-Step Instructions

OR you can download the attached file and copy it your SC's data folder following the simpler instructions here: How to Use an Advanced Custom Study or a Study Collection: Manually Installing Advanced Custom Study Related Files


#include "sierrachart.h"

SCDLLName("Gilbert's Custom Studies")

SCSFExport scsf_ConvertNQTVSymbolToIBTradeSymbol(SCStudyGraphRef sc)
{
if(sc.SetDefaults)
{
sc.GraphName = "Convert Symbol: NQTV -> IB Trade";
sc.GraphRegion = 0;

sc.AutoLoop = 1;
}


SCString nqtv_str;
nqtv_str.Format("-NQTV");

SCString ib_trade_symbol;

if (sc.Symbol.Right(5) == nqtv_str)
{
ib_trade_symbol.Format("%s-STK-SMART-USD", sc.Symbol.Left(-5).GetChars());
}

if (sc.TradeAndCurrentQuoteSymbol != ib_trade_symbol)
{
sc.TradeAndCurrentQuoteSymbol = ib_trade_symbol;
sc.AddMessageToLog("Switched trade symbol from NQTV to IB.", 0);
}
}

Date Time Of Last Edit: 2022-02-08 16:25:36
attachmentconvert_nqtv_to_ib_64.dll - Attached On 2022-02-08 16:23:58 UTC - Size: 887.5 KB - 436 views
[2022-02-08 17:01:23]
User504778 - Posts: 22
I guess you don't really need "-STK-SMART-USD" for IB trading. The following code works for me. Just manually type a symbol without the suffix on the chart screen, like type SPY or AAPL, as usual to change symbol, it will set the new trading symbols for you. You should have the box "Use As Trade Only Symbol" checked in the Chart Settings.


#include "sierrachart.h"

SCDLLName("NQTV IB Trading DLL")

SCSFExport scsf_NQTV_IB_Trading(SCStudyInterfaceRef sc)
{
  sc.GraphRegion = 0;
  sc.GraphName = "NQTV IB Trading";
  if (sc.Symbol.Right(5) != "-NQTV"){
    sc.DataFile = sc.Symbol + "-NQTV.scid";
    sc.TradeAndCurrentQuoteSymbol = sc.Symbol;
  }
}

[2022-02-08 17:24:52]
1+1=10 - Posts: 270
@User504778

That's a cool idea to be able to type AAPL and let the study add the -NQTV.

I don't have an IB account currently so I can't check for sure but I think the issue is while you can chart in SC using AAPL-NQTV, if you try to send an order to IB it won't recognize AAPL-NQTV as a symbol. In the US, while AAPL is listed on the NASDAQ you can actually trade it on multiple exchanges: e.g. BATS, IEX, NYSE, EDGEA. You can see the exchanges if you scroll down a bit to where it says exchange fees here: https://www.interactivebrokers.com/en/index.php?f=1590&p=stocks2

Most IB investors ask IB to pick an exchange to route their AAPL order to, which IB calls SMART routing. So in AAPL-STK-SMART-USD you're not only telling IB you want to trade AAPL but you also want IB to SMART route it, as opposed to AAPL-STK-NYSE-USD where you want IB to only route your AAPL orders to the NYSE exchange. SC is using the IB's API to communicate and I used to do some programming with that same API and this is how it typically works.

In summary, I think the AAPL-STK-SMART-USD format is necessary.
Date Time Of Last Edit: 2022-02-08 17:25:47
[2022-02-08 17:38:11]
User504778 - Posts: 22
I believe the default route for IB trading is SMART, so unless you specify the market maker or change the default setting in IB, the order will be routed through IB's algorithm. You will see that every order goes through a different MM in the order history.

Certainly if you want to be sure, the code can be simply modified as:


#include "sierrachart.h"

SCDLLName("NQTV IB Trading DLL")

SCSFExport scsf_NQTV_IB_Trading(SCStudyInterfaceRef sc)

{

sc.GraphRegion = 0;

sc.GraphName = "NQTV IB Trading";

if (sc.Symbol.Right(5) != "-NQTV"){

sc.DataFile = sc.Symbol + "-NQTV.scid";

sc.TradeAndCurrentQuoteSymbol = sc.Symbol + "-STK-SMART-USD";

}

}

[2022-02-08 18:36:03]
1+1=10 - Posts: 270
@User504778. It is definitely possible that SC's usage of the IB API may assume the SMART route.
Date Time Of Last Edit: 2022-02-08 18:36:23
[2022-02-08 19:26:09]
Пользователь488020 - Posts: 99
Hello! I looked at your example, I want to ask a question why is this necessary?
[2022-02-08 19:51:44]
1+1=10 - Posts: 270
If you have an Interactive Brokers (IB) account, you can subscribe to data in the IB system, and chart & trade IB symbols, like AAPL-STK-SMART-USD, directly in SC. However, SC does not recommend using IB's data for reasons I've listed below that come from SC's docs on IB here: Interactive Brokers Trading Service: Interactive Brokers Market Data Problems


There are a wide array of issues you will and can potentially have with Interactive Brokers market data. They are as follows:

Missing historical data (moderately common)
Slow historical data downloading (common)
Real-time data not updating (uncommon)
Incomplete price and volume data ( Completely normal and routine. Happens all the time.)
Confusing and complex symbology which can change from time to time (moderately common)
No real-time data (Moderately common and depends upon symbol. In particular CFD symbols.)
Inaccurate Bid Volume and Ask Volume which will affect studies which depend upon these which includes the Cumulative Delta Bars studies (100% occurrence all the time).

SC provides their own stock data feeds, like the new NASDAQ feed, and for those who want to use SC's data feeds, they have the problem that SC's symbol conventions do not match IB's. According to the OP, if you chart an SC Nasdaq feed symbol, like AAPL-NQTV, and you leave the default chart settings, then SC will tell IB that the user wants to trade AAPL-NQTV, which IB won't understand. Thus, you have to change the chart setting's "Trading And Current Quote Symbol" so you can chart SC's AAPL-NQTV but trade IB's AAPL-STK-SMART-USD: Chart Settings: Trade and Current Quote Symbol (text box) (Chart >> Chart Settings >> Symbol >> Symbol menu)

As for what the custom studies do, everytime the OP charted a different SC symbol, such as AMZN-NQTV or GE-NQTV or MSFT-NQTV, they would have to manually go into the chart settings and type the a new Trade And Current Quote Symbol to match the SC symbol, so type in AMZN-STK-SMART-USD in the first example. The studies will automatically insert the right Trade symbol as you switch between charts.
[2022-02-09 01:38:17]
John - SC Support - Posts: 36286
In order to change the Trade and Current Quote Symbol symbol when you change the main symbol, you just need to have the Trade/Quote Symbol set in the Symbol Settings for the particular symbol.

For example, for AMZN-NQTV, you would need to go to the Symbol Settings, find the entry for AMZN-NQTV and then enter AMZN-STK-SMART-USD for the Trade/Quote Symbol.

If the particular stock does not have Symbol Settings, then you would duplicate the settings from another stock in order to setup the new stock and enter the appropriate value in the Trade/Quote Symbol.
For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing
[2022-02-09 02:46:03]
1+1=10 - Posts: 270
@John - SC Support

Thanks for the remainder of the built in functionality! That’s certainly an improvement to set the trade symbol once.

The only thing is, even if a equity trader only wanted to trade the top 100 symbols SC provided, it would still take a while to customize all 100 symbol settings. For equity day traders it is not uncommon to trade different symbols everyday if they’re trading momentum/breakout/earnings/gap/unusual volume strategies.

I can understand why a trader would want to avoid the time it would take which is why I shared a study.

Anyway, thanks for all your hard work!
[2022-02-09 14:57:15]
John - SC Support - Posts: 36286
Understood. Just wanted to make sure everyone was aware.
For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing
[2022-02-27 18:47:48]
TraderX703 - Posts: 14
Just wanted to get some input from folks that may have NASDAQ TotalView and Interactive Brokers. Currently I have the real-time dat feed for NTV subscribed to. I also have IBKR connected through SC per SC instructions. How can I ensure I have both the NTV data feed coming in and then IBKR trades are routed to IBKR? The logs are just showing IB TWS socket messages. If I don't have TWS running (which means no trade routing) wouldn't I still have datafeed for charts coming from NTV feed? I'm not seeing that.

So wanted to make sure I'm setup properly.

Thanks for any help.
-James
[2022-02-28 01:58:12]
User504778 - Posts: 22
@TraderX703 if you've selected IB Trading in Data/Service Data Settings, you will need to connect to IB TWS to see data, even though the data feed is from SC. So what you see is normal.
[2022-02-28 02:17:07]
1+1=10 - Posts: 270
@TraderX703,

SC’s Nasdaq TotalView feed and IB use different symbols.

If you’re using SC’s feed on AAPL the symbol is AAPL-NQTV. If you’re trading AAPL on IB the symbol is AAPL-STK-SMART-USD. Thus, you can determine which market data you’re using by looking at the chart’s symbol.
[2022-02-28 02:21:23]
1+1=10 - Posts: 270
Once you understand that distinction between symbols please see the picture of the first post in the thread showing that while the chart symbol should end in -NQTV, the chart’s trade and quote symbol should end in -STK-SMART-USD.
[2022-02-28 14:53:30]
TraderX703 - Posts: 14
@1+1=10
I understand the difference in symbols. Since the thread has confirmed that what I have setup is correct and what i'm seeing is currect, my next step is my overall goal. I trade options. I trade SPY specifically. I use the main SPY charting for my TA. I would like to be able to load a strike price into the SC Dom and trade from there. Currently I use TWS booktrader and it's options chain. I know the symbol setup is someting like SPY-OPT-expiry/strike-SMART-USD. So I was attempting to build a symbol table/spreadsheet for the current Expiry plus next - which is what I do for daytrading. Is this possible yet with options? Is there way to see if the options strike symbol would be corret? Would the use of the script above aid in forming the proper symbol for options? Or is this just something that this setup is not ready for yet?
Thanks.
[2022-02-28 16:07:12]
1+1=10 - Posts: 270
I know the symbol setup is someting like SPY-OPT-expiry/strike-SMART-USD. So I was attempting to build a symbol table/spreadsheet for the current Expiry plus next - which is what I do for daytrading. Is this possible yet with options? Is there way to see if the options strike symbol would be correct?

The SPY option format using IB’s data within SC is below — obviously the symbol is expired, and 110 is way, way OTM, but one with the correct expiration and strike price should work in an SC chart, DOM, and be tradable:
SPY-OPT-20100331-110-P-SMART-100-USD

SC has docs on the format here: Interactive Brokers Symbols: Options Format

The SC Nasdaq feed does not provide option data so the study to convert symbols will not help.

Hmm, it is possible to control SC Spreadsheets from ACSIL so a programmer could make a study which when applied to a chart of the underlying could:
1. Have study input for typical option strike width
2. Have study input for calls/puts/both
3. Have study inputs for how many OTM/ITM strikes away from the ATM strike to generate IB symbols for.
4. Have study input for how many expires to generate strikes for

Using those inputs the relevant IB symbols for the option strikes matching the chosen inputs could be written into an SC spreadsheet (with each expiry as a different sheet). This all assumes you could then copy/paste from the spreadsheet to a chart/DOM settings window to input the symbol.

I may do this at some point as it would be an improvement over the existing situation of using the “Find Symbol” dialog but since I’m not trading options currently it is not at the top of my priority list.

You could hire a programmer to do this. At least the first one is active according to his Twitter profile:
1. https://www.simplesystemtrading.com/?link=x (active -- here's his twitter: https://twitter.com/sstfrederik)
2. https://www.fiverr.com/synergy0911/create-any-trading-code-for-ninjatrader-tradingview-mt4 (it says SC ACSIL in as profile when you scroll down)
3. https://www.upwork.com/freelancers/~01e7a1b7a2edd4853a/
4. https://forgivingcomputers.com/
Date Time Of Last Edit: 2022-02-28 18:31:46
[2022-02-28 22:49:50]
TraderX703 - Posts: 14
@1+1=10
Makes sense on the study in regards to options. Even if I just had the Current Zero Day strikes plus next expiry for SPY is all I need. I use the SPY chart for my TA to find areas for trade. I then enter the option trade based on that. My exit is also based on value of SPY itself but i watch the booktrader in TWS for the gain in option which is where. today, I also execute the trade. I'm in trades for a few minutes to maybe 20min max. There are only one or two trades a day that meet criteria. It's about scale. For example 100 contracts on a .30 move is 4k in profit. I'm not looking for Options tables across a variety of tickers. Just SPY.
I use a 1min and 5min spy chart. I watch Volume profile/ Cumulative Delta and Vwap (plus a 2 day anchored vwap). Everything else is found with supply/demand levels and key S/R levels.

-james
[2022-03-01 03:03:47]
1+1=10 - Posts: 270
@TraderX703
Yes, SPY has the tightest bid-ask spreads of equity/ETF options so smart to focus there. If I end up making such a study I'll let you know. Good luck with your trading!
[2023-08-01 14:27:25]
stephane1 - Posts: 111
hi,
tku for the study... but when I use it the depht market disapear...
stef
[2023-08-07 23:44:03]
UserAR - Posts: 64
User: 1+1=10 or someone from the community could you repost an updated DLL for symbols ending in _MBO? I think many of us having been using the DLL created in the past for -NQTV and it worked great. Thank you
[2023-12-20 19:51:23]
methodtrades - Posts: 46
@UserAR - if you just enter ???? or ??? (and append a suffix if you like) for the trade/quote symbol in the symbol settings for ????_MBO ???_MBO - it will set it automatically anytime I switch to an _MBO symbol. Just make sure the chart settings have "use as trade only symbol" saved.

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account