[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Help with Static variables Please



PureBytes Links

Trading Reference Links


Hope someone can help.

What I am tryinmg to do is count if the last sale was at the bid or 
lower, at the ask or higher, or between the bid and ask.

Eventually I would like to plot this under the price for different 
time frames such as 1 min., 5 min., etc.  But first I need to get it 
to accumulate the values.

I have my chart refresh at 1 second, the lowest i can go.

Here is my code in a guru commentary as a test.

bid = GetRTData("Bid");
ask = GetRTData("Ask");
last = GetRTData("Last");
trdVol = GetRTData("TradeVolume");
sec =GetRTData("UpdateTime");
seco = StrRight(NumToStr( sec, 1, False),2);
secon = StrToNum(seco);

bVol = 0;
sVol = 0;
mVol = 0;
b_Vol = 0;
s_Vol = 0;
m_Vol = 0;

StaticVarSet("buyVol",0  );
StaticVarSet("sellVol",0  );
StaticVarSet("midVol",0  );

	if (Last == ask OR Last > ask)
	{	
		bVol = bVol + trdVol;	
		b_Vol = StaticVarSet("buyVol",bVol);
	}
	if (Last == bid OR Last < bid)
	{
		sVol = sVol + trdVol;
		s_Vol = StaticVarSet("sellVol",sVol);
	}
	if(Last > bid OR Last < ask)
	{
		mVol = mVol + trdVol;
		m_Vol = StaticVarSet("midVol",mVol);
	}

"Bid = "+bid; 
"Ask = "+ask; 
"Last = "+last;
"Vol = "+trdVol;

"\nBuy Vol ="+bvol;  //StaticVarGet("buyVol" );
"Sell Vol ="+sVol;  //StaticVarGet("sellVol" );
"Mid Vol ="+mVol;  //StaticVarGet("midVol" );

"\nBuy Vol ="+StaticVarGet("buyVol" );
"Sell Vol ="+StaticVarGet("sellVol" );
"Mid Vol ="+StaticVarGet("midVol" );

"\nBuy Vol ="+b_Vol;
"Sell Vol ="+s_Vol;
"Mid Vol ="+m_Vol;

I hope someone can understand what I am trying to accomplish.

Thanks
Jerry

p.s. Will Amibroker some day give all the time and sales trades, or 
possibly it allready does?





------------------------ Yahoo! Groups Sponsor --------------------~--> 
Has someone you know been affected by illness or disease?
Network for Good is THE place to support health awareness efforts!
http://us.click.yahoo.com/Rcy2bD/UOnJAA/cosFAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/