A little programming help plz - NinjaTrader Programming | futures io social day trading
futures io futures trading


A little programming help plz
Updated: Views / Replies:5,448 / 31
Created: by mpe66 Attachments:6

Welcome to futures io.

(If you already have an account, login at the top of the page)

futures io is the largest futures trading community on the planet, with over 90,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors – all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you don’t need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

Reply
 6  
 
Thread Tools Search this Thread
 

A little programming help plz

  #21 (permalink)
Elite Member
Sweden
 
Futures Experience: Intermediate
Platform: NinjaTrader
 
Posts: 49 since Mar 2010
Thanks: 29 given, 12 received

Guys,

I appreciate your help and tried your suggestions but get the same error message in both when I try compiling: CS1501 "No overload for method VWAP takes 1 argument". Any thoughts on how this could be fixed?

Thanks,

Mpe

Reply With Quote
 
  #22 (permalink)
Site Administrator
Manta, Ecuador
 
Futures Experience: Advanced
Platform: My own custom solution
Favorite Futures: E-mini ES S&P 500
 
Big Mike's Avatar
 
Posts: 46,238 since Jun 2009
Thanks: 29,350 given, 83,219 received


mpe66 View Post
Guys,

I appreciate your help and tried your suggestions but get the same error message in both when I try compiling: CS1501 "No overload for method VWAP takes 1 argument". Any thoughts on how this could be fixed?

Thanks,

Mpe

Please attach your complete code (file).

Mike

Due to time constraints, please do not PM me if your question can be resolved or answered on the forum.

Need help?
1) Stop changing things. No new indicators, charts, or methods. Be consistent with what is in front of you first.
2) Start a journal and post to it daily with the trades you made to show your strengths and weaknesses.
3) Set goals for yourself to reach daily. Make them about how you trade, not how much money you make.
4) Accept responsibility for your actions. Stop looking elsewhere to explain away poor performance.
5) Where to start as a trader? Watch this webinar and read this thread for hundreds of questions and answers.
6)
Help using the forum? Watch this video to learn general tips on using the site.

If you want
to support our community, become an Elite Member.

Reply With Quote
 
  #23 (permalink)
Elite Member
Sweden
 
Futures Experience: Intermediate
Platform: NinjaTrader
 
Posts: 49 since Mar 2010
Thanks: 29 given, 12 received



Big Mike View Post
Please attach your complete code (file).

Mike

I have 2 different ones but can't export them with errors(?). The first one, MooreTech's, looks like this:

public class VwapOscillator4 : Indicator
{
#region Variables
// Wizard generated variables
// User defined variables (add any user defined variables below)
#endregion

/// <summary>
/// This method is used to configure the indicator and is called once before any bar data is loaded.
/// </summary>
protected override void Initialize()
{
Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Bar, "Plot0"));
Overlay = false;
}

/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
// Use this method for calculating your indicator values. Assign a value to each
// plot below by replacing 'Close[0]' with your own formula.

TimeSpan endtime = new TimeSpan(0,0,0);
TimeSpan starttime = new TimeSpan(0,0,0);
double vwap = VWAP(1,endtime,3,1,2,3,true,true,starttime).VWAPLine[0];
double sdupper = VWAP(1,endtime,3,1,2,3,true,true,starttime).SD1Upper[0];
double denom = sdupper-vwap;

if (denom!=0)
Value.Set ((Close[0] - vwap) / (sdupper - vwap));
else
Value.Set(0);
}



Zondor's:



public class WvapOscillator3 : Indicator

{
#region Variables
private VWAP vwap1;
private bool init = false;
TimeSpan starttime, endtime;
private double vwap, sdupper, denom;
#endregion


protected override void Initialize()
{
Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Line, "Plot0"));
Overlay = false;
}


protected override void OnBarUpdate()
{
if (!init)
{
//endtime = new TimeSpan(0, 0, 0);
//starttime = new TimeSpan(0, 0, 0);
//vwap1 = VWAP(1, endtime, 3, 1, 2, 3, true, true, starttime);
vwap1=VWAP(Close); // define the instance of the external indicator to be used later
init = true;
}
//endtime = new TimeSpan(0, 0, 0);
//starttime = new TimeSpan(0, 0, 0);

vwap = vwap1.VWAPLine[0];
sdupper = vwap1.SD1Upper[0];
denom = sdupper - vwap;

if (denom != 0)
Value.Set((Close[0] - vwap) / denom);
else
Value.Set(0);

}


I get the same error in both: CS1501 "No overload for method VWAP takes 1 argument"

Reply With Quote
 
  #24 (permalink)
Elite Member
Orlando, Florida
 
Futures Experience: Advanced
Platform: NinjaTrader, TradeStation, MultiCharts, eSignal, MetaTrader
Favorite Futures: ES
 
Posts: 56 since Aug 2010
Thanks: 3 given, 66 received


mpe66 View Post
I have 2 different ones but can't export them with errors(?). The first one, MooreTech's, looks like this:

public class VwapOscillator4 : Indicator
{
#region Variables
// Wizard generated variables
// User defined variables (add any user defined variables below)
#endregion

/// <summary>
/// This method is used to configure the indicator and is called once before any bar data is loaded.
/// </summary>
protected override void Initialize()
{
Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Bar, "Plot0"));
Overlay = false;
}

/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
// Use this method for calculating your indicator values. Assign a value to each
// plot below by replacing 'Close[0]' with your own formula.

TimeSpan endtime = new TimeSpan(0,0,0);
TimeSpan starttime = new TimeSpan(0,0,0);
double vwap = VWAP(1,endtime,3,1,2,3,true,true,starttime).VWAPLine[0];
double sdupper = VWAP(1,endtime,3,1,2,3,true,true,starttime).SD1Upper[0];
double denom = sdupper-vwap;

if (denom!=0)
Value.Set ((Close[0] - vwap) / (sdupper - vwap));
else
Value.Set(0);
}



Zondor's:



public class WvapOscillator3 : Indicator

{
#region Variables
private VWAP vwap1;
private bool init = false;
TimeSpan starttime, endtime;
private double vwap, sdupper, denom;
#endregion


protected override void Initialize()
{
Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Line, "Plot0"));
Overlay = false;
}


protected override void OnBarUpdate()
{
if (!init)
{
//endtime = new TimeSpan(0, 0, 0);
//starttime = new TimeSpan(0, 0, 0);
//vwap1 = VWAP(1, endtime, 3, 1, 2, 3, true, true, starttime);
vwap1=VWAP(Close); // define the instance of the external indicator to be used later
init = true;
}
//endtime = new TimeSpan(0, 0, 0);
//starttime = new TimeSpan(0, 0, 0);

vwap = vwap1.VWAPLine[0];
sdupper = vwap1.SD1Upper[0];
denom = sdupper - vwap;

if (denom != 0)
Value.Set((Close[0] - vwap) / denom);
else
Value.Set(0);

}


I get the same error in both: CS1501 "No overload for method VWAP takes 1 argument"

The issue in Zondor's code is in the following line:

vwap1=VWAP(Close); // define the instance of the external indicator to be used later

The VWAP indicator accepts numerous inputs (as shown in the code I provided). I don't see how that error would occur with the code I provided, as my code never passes only 1 parameter to the VWAP indicator. Please try to download the indicator I provided, then call it from your indicator as I did above. It seemed to work fine on my end.

Reply With Quote
The following user says Thank You to MooreTech for this post:
 
  #25 (permalink)
Elite Member
Sweden
 
Futures Experience: Intermediate
Platform: NinjaTrader
 
Posts: 49 since Mar 2010
Thanks: 29 given, 12 received


MooreTech View Post
The issue in Zondor's code is in the following line:

vwap1=VWAP(Close); // define the instance of the external indicator to be used later

The VWAP indicator accepts numerous inputs (as shown in the code I provided). I don't see how that error would occur with the code I provided, as my code never passes only 1 parameter to the VWAP indicator. Please try to download the indicator I provided, then call it from your indicator as I did above. It seemed to work fine on my end.

Beautiful. I got it working now. Thanks a lot for all your help. I want to get different colored histogram for positive/negative values. When I get that figured out I'll post it for anyone who wants to try it.

Reply With Quote
The following user says Thank You to mpe66 for this post:
 
  #26 (permalink)
Elite Member
Sweden
 
Futures Experience: Intermediate
Platform: NinjaTrader
 
Posts: 49 since Mar 2010
Thanks: 29 given, 12 received

I'm trying to add a positive and a negative plot with different colors. If indicator value is > 0 plot "Positive" plot etc but don't really know how to do it.

protected override void Initialize()
{
Add(new Plot(Color.FromKnownColor(KnownColor.Lime), PlotStyle.Bar, "Positive"));
Add(new Plot(Color.FromKnownColor(KnownColor.Red), PlotStyle.Bar, "Negative"));
Overlay = false;
}

/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
// Use this method for calculating your indicator values. Assign a value to each
// plot below by replacing 'Close[0]' with your own formula.

TimeSpan endtime = new TimeSpan(0,0,0);
TimeSpan starttime = new TimeSpan(0,0,0);
double vwap = VWAP(1,endtime,3,1,2,3,true,true,starttime).VWAPLine[0];
double sdupper = VWAP(1,endtime,3,1,2,3,true,true,starttime).SD1Upper[0];
double denom = sdupper-vwap;


if (denom!=0)
Value.Set ((Close[0] - vwap) / (sdupper - vwap));
else
Value.Set(0);

if (Value > 0)
Positive.Set;
else
Negative.Set;

}

Reply With Quote
 
  #27 (permalink)
Elite Member
Sweden
 
Futures Experience: Intermediate
Platform: NinjaTrader
 
Posts: 49 since Mar 2010
Thanks: 29 given, 12 received

Or could I do something like this:

TimeSpan endtime = new TimeSpan(0,0,0);
TimeSpan starttime = new TimeSpan(0,0,0);
double vwap = VWAP(1,endtime,3,1,2,3,true,true,starttime).VWAPLine[0];
double sdupper = VWAP(1,endtime,3,1,2,3,true,true,starttime).SD1Upper[0];
double denom = sdupper-vwap;
double plotval = ((Close[0] - vwap) / (sdupper - vwap));



if ((denom!=0) && (plotval>0 )
Positive.Set( plotval );
else
0
if ((denom!=0) && (plotval<0 )
Negative.Set( plotval );
else
0

Reply With Quote
 
  #28 (permalink)
Elite Member
Sweden
 
Futures Experience: Intermediate
Platform: NinjaTrader
 
Posts: 49 since Mar 2010
Thanks: 29 given, 12 received

Figured it out:

{
// Use this method for calculating your indicator values. Assign a value to each
// plot below by replacing 'Close[0]' with your own formula.

TimeSpan endtime = new TimeSpan(0,0,0);
TimeSpan starttime = new TimeSpan(0,0,0);
double vwap = VWAP(1,endtime,3,1,2,3,true,true,starttime).VWAPLine[0];
double sdupper = VWAP(1,endtime,3,1,2,3,true,true,starttime).SD1Upper[0];
double denom = sdupper-vwap;
double plotval = ((Close[0] - vwap) / (sdupper - vwap));

if ((denom!=0) && plotval > 0)
{
Positive.Set(plotval);
}
if ((denom!=0) && plotval < 0)
{
Negative.Set(plotval);
}


}

Reply With Quote
 
  #29 (permalink)
Elite Member
Portland Oregon, United States
 
Futures Experience: Beginner
Platform: Ninjatrader®
Broker/Data: CQG, Kinetick
Favorite Futures: Gameplay Klownbine® Trading of Globex
 
Zondor's Avatar
 
Posts: 1,327 since Jul 2009
Thanks: 1,246 given, 2,635 received

Too many indicators with the same name ("VWAP")

My code did not work because I was not using the same version of VWAP as MooreTech. My version (form post 258 on NT forum) did not accept any parameters. After switching to his version and changing the ONE LINE of my code that calls the external VWAP to use his parameter syntax, it worked.

However his code is extremely and unnecessarily inefficient and wasteful of resources. To understand why, see this:

RWT-004 :: Move the Markets

In addition, note that the color of the plot should be changed by using the PlotColors method on a SINGLE plot, NOT by switching back and forth between two different plots, which is SO NT6.5.

So let's take full advantage of the PlotColors method and have a FOUR COLOR plot. The four colors will represent above VWAP rising and falling and below VWAP risng and falling.

To be continued....

Reply With Quote
 
  #30 (permalink)
Elite Member
Portland Oregon, United States
 
Futures Experience: Beginner
Platform: Ninjatrader®
Broker/Data: CQG, Kinetick
Favorite Futures: Gameplay Klownbine® Trading of Globex
 
Zondor's Avatar
 
Posts: 1,327 since Jul 2009
Thanks: 1,246 given, 2,635 received

All Better Now


Made some changes. Note that this is for NT7 ONLY.

Incorporated Cvax's version of VWAP, the one that MooreTech used. Renamed it so that it won't get confused with the other versions of VWAP that are floating around out there.

Added the ability to change the start time and end time; they are now user settings of the VWAP oscillator.

Added a zero line so you can tell at a glance whether price is above or below VWAP. It plots two different colors depending on whether VWAP is rising or falling.

Added multi color plotting to the oscillator line, different colors for rising and falling.

Retained correct implementation of calls to external indicator using predefined instances.

You will note that in addition to the enhanced features, this runs much faster than the MooreTech version, which uses the incorrect "newbie" method of calling VWAP. Try both versions on a 10,000 bar chart with calculate on bar close set to false and see which one loads faster.

Attached Thumbnails
A little programming help plz-vwap-oscillator.jpg  
Attached Files
Register to download File Type: zip VwapOscillator.zip (9.8 KB, 46 views)
Reply With Quote
The following 8 users say Thank You to Zondor for this post:

Reply



futures io > > > > > A little programming help plz

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)

Linda Bradford Raschke: Reading The Tape

Elite only

Adam Grimes: TBA

Elite only

NinjaTrader: TBA

January

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Visual Programming (programming without coding) LukeGeniol Platforms and Indicators 11 September 16th, 2016 01:49 PM
Help with programming concept r3algood NinjaTrader Programming 3 July 30th, 2011 04:21 AM
Indicator programming Mondrakete NinjaTrader Programming 3 April 3rd, 2011 02:02 PM
HELP with understanding this FORMULA plz.... mdsvtr Currency Futures 1 February 11th, 2011 10:11 PM
HELP with RECOMMENDING a Ninja Script Consultant plz... mdsvtr Trading Reviews and Vendors 3 November 6th, 2010 11:12 AM


All times are GMT -4. The time now is 08:43 AM.

Copyright © 2017 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
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.
no new posts
Page generated 2017-12-12 in 0.27 seconds with 20 queries on phoenix via your IP 54.90.207.75