most trader by number of trades how to script that?

Discussion in 'Strategy Building' started by mute9003, Oct 8, 2024.

  1. mute9003

    mute9003

    is one tick = one trade?

    how is "number of trades" calculated by the brokers or is it a separate data feed from the exchanges that we dont have access to?

    i saw someone using number of trades on their scanner to show most traded by number of trades and it was very helpful for daytrading since the most trades by volume sometimes are not most active

    so is there a way to set up the scanner for example in TOS or webull to show most active by number of trades on the day?
     
  2. MarkBrown

    MarkBrown

    gpt 4o

    1. Is One Tick Equal to One Trade?
    No, one tick is not the same as one trade.

    • Tick: In trading, a tick refers to the smallest price movement an asset can make. For example, in the E-mini S&P 500 futures (ES), a tick represents a price movement of 0.25 points, and the monetary value is $12.50 per tick.
    • Trade: A trade occurs when a buyer and a seller agree on a price and execute a transaction. A single trade could move the price, causing a tick, or it could happen without moving the price, depending on the market conditions.
    In summary, a trade is an actual transaction, whereas a tick represents a price movement. Multiple trades can happen at the same price level (causing no tick), and one tick could represent the result of many trades.

    2. How is "Number of Trades" Calculated by Brokers?
    The number of trades is the total count of individual transactions that have occurred over a given time frame, such as for the day or during a session.

    Brokers and exchanges calculate this based on the number of transactions, regardless of their size (i.e., how many shares/contracts were traded in each transaction). It's important to note:

    • One trade can involve a single share or thousands of shares/contracts.
    • The number of trades metric counts the raw number of transactions, not the volume of shares/contracts traded.
    Number of trades data is typically available from exchanges as part of the market data feed. However, it is possible that not all brokers provide this information by default. Some platforms calculate this internally, and they may provide the "number of trades" as a part of the data they present, especially for active trading purposes.

    3. Is There a Separate Data Feed for "Number of Trades"?
    There is no specific "number of trades" data feed separate from general market data feeds. Most exchanges provide:

    • Price and volume data (including trade-by-trade data).
    • Some platforms, however, may aggregate the number of trades and present it as a metric. This data comes from the exchange but might not be available in all trading platforms by default.
    In some cases, data aggregators like Level II feeds (which show orders waiting to be filled) or specialized software may offer more granular views of the number of trades.

    4. Can I Use "Number of Trades" in a Scanner (e.g., TOS or Webull)?
    Currently, popular platforms like ThinkorSwim (TOS) and Webull don’t offer "number of trades" as a built-in scanner filter, although they do allow scanning based on volume and other metrics.

    However, you can achieve similar results indirectly by using volume, time-based filters, and specific studies. Since volume and number of trades are correlated but not always directly (as you noted), you might find scanners that work on volume by trade count useful.

    Here are some possible workarounds:

    ThinkorSwim (TOS):
    • TOS doesn't natively offer a "number of trades" scanner, but you can create custom scans based on volume per time period (such as 1-minute bars), which can give a rough approximation of activity.

      You can also explore the TOS Stock Hacker to look for specific studies (like "Volume by Price") or create a custom script using thinkScript that highlights unusually high volume bars in a short time frame, which may indicate high trade frequency.
    Webull:
    • Webull doesn’t have a built-in scanner for "number of trades" either. You can filter stocks by volume and volatility in their screener, but "number of trades" isn’t available.
    5. Is There a Way to Set Up a Scanner to Show Most Active by Number of Trades?
    While there isn’t a direct scanner for "number of trades" in most retail platforms, there are ways to approximate it or access alternative platforms that provide this functionality:

    • Alternative Platforms: Some professional trading platforms or market data services might offer a scanner for the number of trades. Platforms like TradeStation, Sterling Trader, and Bookmap could potentially offer this feature, as they have more granular access to exchange data.

    • Custom Scripting: If you're using a platform that allows custom scripting (like TOS), you could create a script that tracks the number of trades by approximating it based on volume and time-based filters.
    Conclusion:
    • Tick ≠ Trade: A tick is a price movement, while a trade is a transaction.
    • Number of trades is calculated by brokers based on transactions, and it is part of the market data feed.
    • Most retail platforms like TOS and Webull don’t directly offer a scanner for "number of trades," but alternative platforms might provide that data, or you can create custom scanners that approximate it using volume and time-based metrics.
     
  3. Aloha mark,
    Why do you post so many half assed chatGPT answers? I'm pretty sure you're an intelligent trader.. and I know that you know it's obvious he's taking about a tick chart. 1 trade = 1 "tick", regardless of number of shares/contracts traded. Maybe make a new handle so you dont diminish the quality of yours? MarkBrownBot

    Most all platforms can do tick charts.

    mute, I havent used TOS in years, but i think you could do this. Make a hotlist of any stocks you want to evaluate. Make this indicator (below). Add it to the hotlist window. Ask chat GPT if you have questions, or tell it to try again with its code. It often gives answers as half baked as mark's response. For example, TOS might not even have a barnumber function. So tell it that, and it will try again. Tell it where the code has errors, and what lines they're on. GL


    Me: is there a barnumber variable in TOS?

    Chat GPT:
    Yes, Thinkorswim (ToS) has a barNumber variable that you can use in ThinkScript to track the sequential number of the bar in a chart. This is helpful for determining the position of a bar relative to the start of a session or the entire dataset.

    Example Usage:
    Here’s how you can reference and use barNumber in ThinkScript:

    thinkscript
    plot barNum = BarNumber();

    This will plot the bar number on the chart, incrementing with each new bar.

    Key Points:
    • BarNumber(): Returns the sequential number of the bar. The first bar is 1, and it increments as new bars are added to the chart.
    • You can use this to track how many bars have formed over time, even in a tick chart, since each bar in a tick chart represents a fixed number of trades (ticks), and the bar number will increment accordingly.
    Example: Counting Bars Over a Specific Period
    If you want to count the number of bars over a specific time frame (say, from a certain time of day), you can compare the current bar number to the bar number at the start of the time range.

    thinkscript
    # Capture the bar number when a certain condition is met (e.g., the time of day)
    def startTime = SecondsFromTime(0930) == 0; # Example for the 9:30 AM start time
    def startBarNum = if startTime then BarNumber() else startBarNum[1];

    # Calculate the number of bars that have occurred since the start time
    def barsSinceStart = BarNumber() - startBarNum;

    plot barsCount = barsSinceStart;

    In this script:

    • startBarNum captures the bar number at 9:30 AM (or any specific time).
    • barsSinceStart shows the number of bars that have occurred since that time.
    This approach can help you analyze tick charts or other bar-based data over a specific time range.
     
    macha likes this.
  4. mute9003

    mute9003

    sht you making me access braincells i forgot still exists somewhere.
    i used to make websites back in the late 90s. learned c++ and few other things almost fried my brain trying to learn assembly.(for not so legal purposes lol)