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,453 / 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

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

Maybe I should have the settings under Initialize() like in the original vwap indicator?

protected override void Initialize()
{
Add(new Plot(Color.Orange, "VWAP"));
Add(new Plot(Color.Blue, "SD1 Upper"));
Add(new Plot(Color.Blue, "SD1 Lower"));
Add(new Plot(Color.Blue, "SD2 Upper"));
Add(new Plot(Color.Blue, "SD2 Lower"));
Add(new Plot(Color.Blue, "SD3 Upper"));
Add(new Plot(Color.Blue, "SD3 Lower"));

vwapsd = new DataSeries(this);
AutoScale = false;
BarsRequired = 1;
CalculateOnBarClose = false;
Overlay = true;
PriceTypeSupported = true;
}

Reply With Quote
 
  #12 (permalink)
Elite Member
Wrocław, Poland
 
Futures Experience: Intermediate
Platform: NinjaTrader, Racket
Favorite Futures: Ockham's razor
 
gregid's Avatar
 
Posts: 651 since Aug 2009
Thanks: 321 given, 605 received


mpe66 View Post
I'm using the indicator from post 258 in this thread on the NT forum. I'm pretty sure the name of the plot is just VWAP or at least that's what it's called in the indicator settings...

Names of the plots are not the ones in the indicator's settings but in the properties region of the vwap.cs file

Attached Thumbnails
A little programming help plz-2010-08-28_1436.png  
Reply With Quote
The following user says Thank You to gregid for this post:
 
  #13 (permalink)
Elite Member
Wrocław, Poland
 
Futures Experience: Intermediate
Platform: NinjaTrader, Racket
Favorite Futures: Ockham's razor
 
gregid's Avatar
 
Posts: 651 since Aug 2009
Thanks: 321 given, 605 received


As for properties: use the wizard and ask for one of the VWAP plots, then generate the code and you will see what parameters were included

You could actually have your indicator done using wizard only

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


gregid View Post
As for properties: use the wizard and ask for one of the VWAP plots, then generate the code and you will see what parameters were included

You could actually have your indicator done using wizard only

Thanks, I'll try that.

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


gregid View Post
As for properties: use the wizard and ask for one of the VWAP plots

How do I do that? Been going through the help guides but can't get this to work.

Reply With Quote
 
  #16 (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

Use the attached indicator. You can call it from your code as follows:

TimeSpan endtime = new TimeSpan(0,0,0);
TimeSpan starttime = new TimeSpan(0,0,0);
double a = VWAP(1,endtime,1,1,1,1,true,true,starttime)[0];

Attached Files
Register to download File Type: zip VWAP.zip (5.5 KB, 13 views)
Reply With Quote
 
  #17 (permalink)
Elite Member
Wrocław, Poland
 
Futures Experience: Intermediate
Platform: NinjaTrader, Racket
Favorite Futures: Ockham's razor
 
gregid's Avatar
 
Posts: 651 since Aug 2009
Thanks: 321 given, 605 received

what exactly you can't do?

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


MooreTech View Post
Use the attached indicator. You can call it from your code as follows:

TimeSpan endtime = new TimeSpan(0,0,0);
TimeSpan starttime = new TimeSpan(0,0,0);
double a = VWAP(1,endtime,1,1,1,1,true,true,starttime)[0];

Thanks for all your help. I don't really know what I'm doing but I tried pasting the 3 lines into my script in onbarupdate(?) and parameters into VWAP() and got it to compile without errors. However, it doesn't plot anything on my chart. Should it be VWAP().VWAPLine or just VWAP().VWAP for this VWAP indicator? I'll attach my indicator...

Mpe

Attached Files
Register to download File Type: zip VwapOscillator2.zip (7.3 KB, 15 views)
Reply With Quote
 
  #19 (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

Your indicator should look like this

 
Code
                            

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

Reply With Quote
 
  #20 (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

Try this


This works, however I was not able to pass the starttime and endtime parameters into the vwap function call. The line that is commented out had syntax errors.

The code is optimized for fast execution by using predefined instances of the external indicator (VWAP). Not doing this is poor practice.


This oscillator does a really great job of FOLLOWING the price. While coding it was fun, I do not see how it would be useful in trading.



public class VwapOscillator2 : 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);

}


Last edited by Zondor; August 28th, 2010 at 06:10 PM.
Reply With Quote

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)

Jigsaw Trading: TBA

Elite only

FuturesTrader71: TBA

Elite only

NinjaTrader: TBA

Jan 18

RandBots: TBA

Jan 23

GFF Brokers & CME Group: Futures & Bitcoin

Elite only

Adam Grimes: TBA

Elite only

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 06:33 PM.

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-14 in 0.15 seconds with 20 queries on phoenix via your IP 54.226.227.175