I have some questions about bid/ask and trading

ezrollin

Member
1) When I program to show the diffrence between the bid and ask in a scan or watchlist, so I can only look at small spreads, it often screws up,
I think it never works except maybe during market hours?
Why is this? I'm 100% sure Mobius answered this for me before but I dont remember?
I'm sure he said it'll never work.

2) How do I get a percent out of the total bid ask volume?
Say 10000 shares of buying volume * 100? I want it expressed out of 100%

3) I sell 0 day SPX credit spreads. I'm looking for an indicator that will help me determine where SPX will probably close at.
I can look at market profile, market internals, and the 30 minute chart. But is there an indicator that will help me be more often right?

4) I know we cant program clouds, labels, buttons, dots, arrows, etc on mobile but is there any way to work around that for something like the Trend Reversal indicator?
Thanks

I realized in order to get a percentage I would have to compare my buying or selling volume to another number. (ASPercent function wont help me). So I did it to a 50 period of both buying and selling. BUT I want it to be based off the minute 50 period. How do I make only the total volume based on the 50 period in minute charts no matter what chart I'm on (or in a scan)?

Code:
def agg = AggregationPeriod.MIN;
plot data = close(period = agg);
def fittyperiodvolume = Round(Average(Volume,50));
def buyingpercent = fittyperiodvolume / buying;
addlabel (yes, buyingpercent, color.dark_green);
def sellingpercent = fittyperiodvolume / selling;
addlabel (yes, sellingpercent, color.red);

My buying and selling variable is already defined and they work.
 
Last edited by a moderator:
Solution
@ezrollin Well then, it sure does not look like a scan code, seems that you are writing a study that determines the buying and selling volume expressed as a percentage of the total volume. Assuming your mathematical equations for Buying/Selling is correct, here's what your study would look like. You can add bells and whistles to plot, color, or whatever you like but the base code is here. I have chosen to implement this as a chart label. All the best as you complete your project

Code:
def O = open;
def H = high;
def C = close;
def L = low;
def V = volume;
def BuyV = (V * (C - L) / (H - L));
def SellV = (V * (H - C) / (H - L));
def BuyPct = BuyV / V;
def SellPct = SellV / V;
AddLabel(1, "Volume Buy Percent = " + AsPercent(BuyPct)...

tomsk

Well-known member
VIP
@ezrollin My recollection of Mobius comments during my time in the lounge is that bid/ask works only on intraday aggregations. You can get Bid and Ask in a Watchlist by referencing the built-in Bid() and Ask() studies. Bid and Ask is not available in the scanner. I don't use mobile so can't help with your queries on mobile. Hope this info helps

Post your COMPLETE scan code, and more importantly, describe what you're attempting to scan for. To enable anyone to assist you, do provide as much detail, context, information as necessary to help bring the reader up to speed. Only then perhaps a scan can be constructed.
 

ezrollin

Member
ALL I'm trying to do is plot the buying and selling volume seperately but expressed in percentage.

Code:
declare lower;
declare zerobase;

input Audible_Alert = yes;
def Deviation_Length = 60;
def Deviate = 2;
def volumestdev = RelativeVolumeStDev(length = Deviation_Length);
def abovedev = volumestdev >= Deviate;
def belowdev = volumestdev <= Deviate;

def increase = volume > volume[1];
def devincrease = increase and abovedev;
def decrease = volume < volume[1];
def devdecrease = decrease and abovedev;

def O = open;
def H = high;
def C = close;
def L = low;
def V = volume;

plot Buying = (V * (C - L) / (H - L));
     buying.AssignValueColor( Color.dark_green);
plot Selling = (V * (H - C) / (H - L));
     selling.AssignValueColor( Color.red);

def fittyperiodvolume = Round(Average(Volume,50));
plot buyingpercent = fittyperiodvolume / buying;
buyingpercent.AssignValueColor( Color.dark_green);
addlabel(yes," buys: "+buying+ " sells: " +selling, color.black);
 
Last edited by a moderator:

tomsk

Well-known member
VIP
@ezrollin Well then, it sure does not look like a scan code, seems that you are writing a study that determines the buying and selling volume expressed as a percentage of the total volume. Assuming your mathematical equations for Buying/Selling is correct, here's what your study would look like. You can add bells and whistles to plot, color, or whatever you like but the base code is here. I have chosen to implement this as a chart label. All the best as you complete your project

Code:
def O = open;
def H = high;
def C = close;
def L = low;
def V = volume;
def BuyV = (V * (C - L) / (H - L));
def SellV = (V * (H - C) / (H - L));
def BuyPct = BuyV / V;
def SellPct = SellV / V;
AddLabel(1, "Volume Buy Percent = " + AsPercent(BuyPct), Color.Cyan);
AddLabel(1, "Volume Sell Percent = " + AsPercent(SellPct), Color.Yellow);
 
Solution

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
128 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Top