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 sellingpercent = fittyperiodvolume / selling;

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 SellPct = SellV / V;

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;

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));
plot Selling = (V * (H - C) / (H - L));
selling.AssignValueColor( Color.red);

def fittyperiodvolume = Round(Average(Volume,50));

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 SellPct = SellV / V;
AddLabel(1, "Volume Sell Percent = " + AsPercent(SellPct), Color.Yellow);``````

ezrollin

Member
That worked perfect! I'm not sure my plan worked out all that great but you're code is exactly right! Thank you!

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
• Exclusive indicators
• Proven strategies & setups
• Private Discord community
• Exclusive members-only content
• 1 full year of unlimited support

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?