I have some questions about bid/ask and trading

E

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
 
Last edited by a moderator:
T

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
 
E

ezrollin

Member
VIP
2) 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)?


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:
T

tomsk

Well-known member
VIP
The only thing I've found is plotting somehow or an alert


Indeed. What you'll find @ezrollin is that you won't have the full functionality available on the Mobile version as compared to the desktop
 
E

ezrollin

Member
VIP
I have trouble with abnormalities coming up in my scans that shouldnt.
How would I write this so something that shouldnt be there isnt there?
if buyingpercent IsNaN then 0;
My syntax is wrong
It makes sense in the english language though
 
E

ezrollin

Member
VIP
def buys = if IsNaN(buyingpercent) then 0 else buyingpercent;
wrote it like this but I think its not giving me good results.
 
E

ezrollin

Member
VIP
My problem is I'm getting infinity results. It has an infinity symbol.
How do I throw away those results?
if buyz > 9999999 then buyz = 0; ????
 
T

tomsk

Well-known member
VIP
@ezrollin 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
 
E

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:
T

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);
 
E

ezrollin

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

Similar threads

Top