I have some questions about bid/ask and trading

ezrollin

Member
VIP
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
VIP
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

Similar threads

Top