NexusFi: Find Your Edge


Home Menu

 





Plotting Midas (Vwap) stdev bands


Discussion in EasyLanguage Programming

Updated
      Top Posters
    1. looks_one rawos with 2 posts (0 thanks)
    2. looks_two Big Mike with 1 posts (0 thanks)
    3. looks_3 Quick Summary with 1 posts (0 thanks)
    4. looks_4 marce77o with 1 posts (0 thanks)
    1. trending_up 3,145 views
    2. thumb_up 0 thanks given
    3. group 2 followers
    1. forum 4 posts
    2. attach_file 1 attachments




 
Search this Thread

Plotting Midas (Vwap) stdev bands

  #1 (permalink)
rawos
Rome
 
Posts: 10 since Feb 2010
Thanks Given: 1
Thanks Received: 3

Hi all, I'm currently using Midas, a slightly different anchored Vwap based on cumulative volume, as dinamyc S/R curve however i was unable to plot correctly the standard deviation bands.
I've tried to use the same formula used on vwap band but after several hours I cannot figured out how to do it properly, so I gave up, the only thing i was able to do it's creating crazy pop-art line.
Someone knows how to do it? @Fat Tails or someone else even if you are using NT do you have some hint for MC?
thanks

 
Code
inputs:
       price1(L),
	StartTime( 930 ),
	StartMonth( 11 ),
	StartDay( 25 ),
	StartYear( 2015  ),
PlotStdev1(false),
PlotStdev_1(false),
PlotStdev2(false),
PlotStdev_2(false),
PlotStdev3(false),
PlotStdev_3(false);
variables:
	StartCalcDate( 0 ),
	VolumeValue( 0 ),
	MedPrice( 0 ),
	PV( 0 ), 
	CumulativeVolume( 0 ),
	CumulativePV( 0 ),
	Started( false ),
	Denom( 0 ), 
	KeyCumVol( 0 ),
	KeyCumPV( 0 ),
	MidasValue( 0 ) ,
Count(1),
VolMidasariance(0),
VolMidasSD(0);

if CurrentBar = 1 then
	StartCalcDate = ELDate( StartMonth, StartDay, StartYear ) ;

{ Midas Calculation }
if (Date >= StartCalcDate and Time >= StartTime) 
	or Date > StartCalcDate 
then
	begin
	VolumeValue = iff( BarType <= 1, Ticks, Volume ) ;
	MedPrice = price1;//high, low, avgprice, MedianPrice  (ancorata da me)
	PV = MedPrice * VolumeValue ;
	CumulativeVolume = VolumeValue + CumulativeVolume ;
	CumulativePV = PV + CumulativePV ;
	end ;

if Started = false and ( ( Date >= StartCalcDate and
 Time >= StartTime ) and ( ( Time[1] < StartTime or
 Date[1] < StartCalcDate ) or Date[1] > StartCalcDate ) ) 
then
	begin
	Started = true ; 
	Denom = 1 ;
	KeyCumVol = CumulativeVolume ;
	KeyCumPV = CumulativePV ;
	end 
else if Denom >= 1 then
	Denom = CumulativeVolume - KeyCumVol ;

if Started then
	begin
	if Denom > 1 then
		MidasValue = ( CumulativePV - KeyCumPV ) / Denom 
	else if Denom = 1 then
		MidasValue = MedPrice ;

	Plot1( MidasValue, "Midas" ) ;

//Start calculation for Standard Deviation	
end;
Value1 = 0;
Value2 = 0;
Value3 = 0;
if (Date >= StartCalcDate and Time >= StartTime) 
	or Date > StartCalcDate 
then
	begin

For Value1 = 0 To Count Begin
Value2 = ((UpTicks[Value1]+DownTicks[Value1])/(UpTicks+DownTicks)) * (Square(price1[Value1]-MidasValue));
Value3 = Value3 + Value2;
End;

VolMidasariance = Value3;
VolMidasSD = SquareRoot(VolMidasariance);
if PlotStdev1 then Plot2(MidasValue + VolMidasSD, "Midas1SDUp");
if PlotStdev_1 then Plot3(MidasValue - VolMidasSD, "Midas1SDDown");
if PlotStdev2 then Plot4(MidasValue + (2*VolMidasSD), "Midas2SDUp");
if PlotStdev_2 then Plot5(MidasValue - (2*VolMidasSD), "Midas2SDDown");
if PlotStdev3 then Plot6(MidasValue + (3*VolMidasSD), "Midas3SDUp");
if PlotStdev_3 then Plot7(MidasValue - (3*VolMidasSD), "Midas3SDDown");
end;

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
Better Renko Gaps
The Elite Circle
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
MC PL editor upgrade
MultiCharts
Strategy stop orders partially filled
EasyLanguage Programming
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Just another trading journal: PA, Wyckoff & Trends
22 thanks
What is Markets Chat (markets.chat) real-time trading ro …
19 thanks
GFIs1 1 DAX trade per day journal
15 thanks
ApexTraderFunding.com experience and review
15 thanks
EG Indicators
11 thanks
  #3 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,471 since Jun 2009
Thanks Given: 33,250
Thanks Received: 101,674


If you need a hint, you should look at the existing C# for Ninja and C++ for Sierra where this indicator already exists.

Mike



Join the free Markets Chat beta: one platform, all the trade rooms!

We're here to help: just ask the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor
Searching for trading reviews? Review this list
Lifetime Elite Membership: Sign-up for only $149 USD
Exclusive money saving offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
  #4 (permalink)
rawos
Rome
 
Posts: 10 since Feb 2010
Thanks Given: 1
Thanks Received: 3


Big Mike View Post
If you need a hint, you should look at the existing C# for Ninja and C++ for Sierra where this indicator already exists.

Mike

but I need it for easylanguage, beside there are valid vwap formulas for this language too, I've just tried to paste it but can't understand why doesn't work, after all should be a simple square root of the variance.

This is the part for the stddev

//Start calculation for Standard Deviation
end;
Value1 = 0;
Value2 = 0;
Value3 = 0;
if (Date >= StartCalcDate and Time >= StartTime)
or Date > StartCalcDate
then begin

//variance part
For Value1 = 0 To Count Begin
Value2 = ((UpTicks[Value1]+DownTicks[Value1])/(UpTicks+DownTicks)) * (Square(price1[Value1]-MidasValue));
Value3 = Value3 + Value2;
End;

VolMidasariance = Value3;
VolMidasSD = SquareRoot(VolMidasariance);

Reply With Quote
  #5 (permalink)
marce77o
Bologna Italy
 
Posts: 1 since Feb 2020
Thanks Given: 0
Thanks Received: 0

I guess it's beacause you var "count" is = 1.
Thanks for the code, cmq!

Reply With Quote




Last Updated on May 3, 2020


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts