NinjaTrader Support Forum  

Go Back   NinjaTrader Support Forum > NinjaScript Development Support > General Programming

General Programming General NinjaScript programming questions.

Reply
 
Thread Tools Display Modes
Old 04-24-2012, 04:05 PM   #1
magnumdbl
Junior Member
 
Join Date: Sep 2011
Location: New Jersery
Posts: 9
Thanks: 2
Thanked 0 times in 0 posts
Send a message via Skype™ to magnumdbl
Default Access to BetterSinewave Variables

I bought the BetterSinewavePB and SR from emini-watch.com.

They say that accessing the variables is very simple, however my coding was
not able to bring them up.

If anyone has experience with this program or his new programs let me know
and I will share my code and you can tell me where I can make the corrections.

They have turned me down on help with my code.

Thanks,

Don
magnumdbl is offline  
Reply With Quote
Old 04-24-2012, 07:41 PM   #2
Crassius
Senior Member
 
Join Date: Nov 2008
Posts: 188
Thanks: 38
Thanked 33 times in 27 posts
Default

Not sure what you are asking... do you want to find the value of a specific plot at a specific bar?
Crassius is offline  
Reply With Quote
Old 04-25-2012, 11:49 AM   #3
magnumdbl
Junior Member
 
Join Date: Sep 2011
Location: New Jersery
Posts: 9
Thanks: 2
Thanked 0 times in 0 posts
Send a message via Skype™ to magnumdbl
Default Better Sinewave - emini-watch

These are the indicator outputs the seller says that I should be able to get.


Use these variables to access public values/states for Better Sine Wave indicators:
BetterSinewave.Sine[BarsAgo]
BetterSinewave.LeadSine[BarsAgo]
BetterSineSR.Support[BarsAgo]
BetterSineSR.Resistance[BarsAgo]
BetterSineSR.BreakLo[BarsAgo]
BetterSineSR.BreakHi[BarsAgo]
BetterSineSR.PullBackSeries[BarsAgo]
BetterSineSR.EndOfTrendSeries[BarsAgo]
BetterSinePB.TrendSeries[BarsAgo] (UpTrend +1, DownTrend -1, NoTrend 0)

I can send you my program if that helps.

#region Using declarations
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Xml.Serialization;
using NinjaTrader.Cbi;
using NinjaTrader.Data;
using NinjaTrader.Gui.Chart;
#endregion

namespace NinjaTrader.Indicator
{

//================================================== ==============
[Description("Gets the 'TrendSeries' .")]
public class dbBSWGet : Indicator
{
private BetterSinePB sig3; //BetterSine PB is part of Trend direction.

//================================================== ==============
#region Variables
// True/False Inputs to show arrows.
private bool showBetterSinePB = false; // 1a (B) Arrows Up/Dn BarC

// BetterSinePB Bar Trend Series
private string bswPassword;
private DataSeries trendSeries; // TrendSeries = +1

#endregion

//================================================== ==============
protected override void Initialize()
{
trendSeries = new DataSeries(this); // This is the BetterSinePB Trend Number.
Overlay = true; // This should draw Plots on the Chart Panel.
DrawOnPricePanel = true;
CalculateOnBarClose = true;
}
//================================================== ==============
protected override void OnStartUp()
{
sig3 = BetterSinePB(Color.Red,bswPassword,Color.Green);
}


protected override void OnBarUpdate()
{

if(CurrentBar<1) return;

// ------------------- Logic for BetterSineWave Arrows -------------------
if( showBetterSinePB == true)
{
// double d = sig3.TrendSeries[0] ; // BetterSinePB (Take out'//' at left)
}



}

#region Properties
// ------- Data Series -------- //

[XmlIgnore()]
[Browsable(false)]
public DataSeries TrendSeries
{
get { return trendSeries; }
set { trendSeries = value;}
}


// BetterSinePB
[Description("Enter your Password.")]
[Category("2 - Better SineWave Input")]
[Gui.Design.DisplayName(" Your Password")]
public string BswPassword
{
get { return bswPassword; }
set { bswPassword = value;}
}


#endregion
}
}

If you have the BetterSinePB you can probably paste this code into a new indicator
and see what I see.
Need to take out the '//' at line 58 and I get the error CS1061 that says:
'NinjaTrader.Indicator.BetterSinePB' does not contain a definition for 'TrendSeries'

Thanks,
Don
magnumdbl is offline  
Reply With Quote
Old 04-25-2012, 02:53 PM   #4
magnumdbl
Junior Member
 
Join Date: Sep 2011
Location: New Jersery
Posts: 9
Thanks: 2
Thanked 0 times in 0 posts
Send a message via Skype™ to magnumdbl
Default Better Sinewave - emini-watch

Here's my .cs. Beware that I did get a strange message saying you would need access to 5 other files which don't involve the cs that i'm sending. Never got that message before.

If it won't work.
It's really easy to paste into a new Indicator. I've done it many times.

Let me know if it imports for you.
I can walk you through the procedure if necessary.
dbl
Attached Files
File Type: zip dbBSWGet.zip (2.3 KB, 19 views)
magnumdbl is offline  
Reply With Quote
Old 04-25-2012, 03:28 PM   #5
Crassius
Senior Member
 
Join Date: Nov 2008
Posts: 188
Thanks: 38
Thanked 33 times in 27 posts
Default

Got it. Successfully imported despite warnings...

I'll play around with it and get back to you.
Crassius is offline  
Reply With Quote
Old 04-25-2012, 04:45 PM   #6
koganam
Senior Member
 
Join Date: Feb 2008
Location: http://omegasigmaindicators.com
Posts: 4,214
Thanks: 30
Thanked 1,721 times in 1,403 posts
Send a message via Skype™ to koganam
Default

Quote:
Originally Posted by magnumdbl View Post
These are the indicator outputs the seller says that I should be able to get.


Use these variables to access public values/states for Better Sine Wave indicators:
BetterSinewave.Sine[BarsAgo]
BetterSinewave.LeadSine[BarsAgo]
BetterSineSR.Support[BarsAgo]
BetterSineSR.Resistance[BarsAgo]
BetterSineSR.BreakLo[BarsAgo]
BetterSineSR.BreakHi[BarsAgo]
BetterSineSR.PullBackSeries[BarsAgo]
BetterSineSR.EndOfTrendSeries[BarsAgo]
BetterSinePB.TrendSeries[BarsAgo] (UpTrend +1, DownTrend -1, NoTrend 0)

I can send you my program if that helps.

#region Using declarations
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Xml.Serialization;
using NinjaTrader.Cbi;
using NinjaTrader.Data;
using NinjaTrader.Gui.Chart;
#endregion

namespace NinjaTrader.Indicator
{

//================================================== ==============
[Description("Gets the 'TrendSeries' .")]
public class dbBSWGet : Indicator
{
private BetterSinePB sig3; //BetterSine PB is part of Trend direction.

//================================================== ==============
#region Variables
// True/False Inputs to show arrows.
private bool showBetterSinePB = false; // 1a (B) Arrows Up/Dn BarC

// BetterSinePB Bar Trend Series
private string bswPassword;
private DataSeries trendSeries; // TrendSeries = +1

#endregion

//================================================== ==============
protected override void Initialize()
{
trendSeries = new DataSeries(this); // This is the BetterSinePB Trend Number.
Overlay = true; // This should draw Plots on the Chart Panel.
DrawOnPricePanel = true;
CalculateOnBarClose = true;
}
//================================================== ==============
protected override void OnStartUp()
{
sig3 = BetterSinePB(Color.Red,bswPassword,Color.Green);
}


protected override void OnBarUpdate()
{

if(CurrentBar<1) return;

// ------------------- Logic for BetterSineWave Arrows -------------------
if( showBetterSinePB == true)
{
// double d = sig3.TrendSeries[0] ; // BetterSinePB (Take out'//' at left)
}



}

#region Properties
// ------- Data Series -------- //

[XmlIgnore()]
[Browsable(false)]
public DataSeries TrendSeries
{
get { return trendSeries; }
set { trendSeries = value;}
}


// BetterSinePB
[Description("Enter your Password.")]
[Category("2 - Better SineWave Input")]
[Gui.Design.DisplayName(" Your Password")]
public string BswPassword
{
get { return bswPassword; }
set { bswPassword = value;}
}


#endregion
}
}

If you have the BetterSinePB you can probably paste this code into a new indicator
and see what I see.
Need to take out the '//' at line 58 and I get the error CS1061 that says:
'NinjaTrader.Indicator.BetterSinePB' does not contain a definition for 'TrendSeries'

Thanks,
Don
I do not understand what you are trying to achieve, and I do not have the Betterxxx indicators, but that message is correct. You have defined sig3 as an instance of BetterSinePB. TrendSeries is a DataSeries that you created as an independent object. There is no definition of your independent TrendSeries inside the BetterSonePB of which sig3 is an instance.
koganam is offline  
Reply With Quote
Old 04-25-2012, 04:52 PM   #7
Crassius
Senior Member
 
Join Date: Nov 2008
Posts: 188
Thanks: 38
Thanked 33 times in 27 posts
Default

Quote:
Originally Posted by koganam View Post
I do not understand what you are trying to achieve, and I do not have the Betterxxx indicators, but that message is correct. You have defined sig3 as an instance of BetterSinePB. TrendSeries is a DataSeries that you created as an independent object. There is no definition of your independent TrendSeries inside the BetterSonePB of which sig3 is an instance.
It also gives the same error when you:

Code:
double test = BetterSinePB(Color.Red,Password,Color.Green).TrendSeries[0];
Any other ideas, oh learned one, Koganam?
Crassius is offline  
Reply With Quote
Old 04-25-2012, 04:56 PM   #8
koganam
Senior Member
 
Join Date: Feb 2008
Location: http://omegasigmaindicators.com
Posts: 4,214
Thanks: 30
Thanked 1,721 times in 1,403 posts
Send a message via Skype™ to koganam
Default

Quote:
Originally Posted by Crassius View Post
It also gives the same error when you:

Code:
double test = BetterSinePB(Color.Red,Password,Color.Green).TrendSeries[0];
Any other ideas, oh learned one, Koganam?
Same error; same reason. TrendSeries is not an entity in BetterSinePB: it is a DataSeries defined in the current class.
koganam is offline  
Reply With Quote
Old 04-25-2012, 05:05 PM   #9
Crassius
Senior Member
 
Join Date: Nov 2008
Posts: 188
Thanks: 38
Thanked 33 times in 27 posts
Default

Thanks for looking into this, Koganam,

Even when I comment out the TrendSeries language in the original posters script... including the properties it won't compile.

The instructions from the indicator vendor are that TrendSeries is a public property of BetterSinePB.

He gives a similar public property for his related indicator BetterSineWave of BetterSineWave.Sine. This compiles:

Code:
double test = BetterSinewave(password,true).Sine[0];
This would store the current bars value of Sine into the double test.

The vendor gives BetterSinePB.TrendSeries[barsAgo] as the instructions for retrieving the public property TrendSeries from BetterSinePB.
Last edited by Crassius; 04-25-2012 at 05:15 PM.
Crassius is offline  
Reply With Quote
Old 04-25-2012, 05:25 PM   #10
koganam
Senior Member
 
Join Date: Feb 2008
Location: http://omegasigmaindicators.com
Posts: 4,214
Thanks: 30
Thanked 1,721 times in 1,403 posts
Send a message via Skype™ to koganam
Default

Quote:
Originally Posted by Crassius View Post
Thanks for looking into this, Koganam,

Even when I comment out the TrendSeries language in the original posters script... including the properties it won't compile.

The instructions from the indicator vendor are that TrendSeries is a public property of BetterSinePB.

He gives a similar public property for his related indicator BetterSineWave of BetterSineWave.Sine. This compiles:

Code:
double test = BetterSinewave(password,true).Sine[0];
This would store the current bars value of Sine into the double test.

The vendor gives BetterSinePB.TrendSeries[barsAgo] as the instructions for retrieving the public property TrendSeries from BetterSinePB.
Uh oh!! It looks like you are right. And since you are using the FQPN, if that were a public property, that should be accessible. What does Intellisense say? It seems to me that the author may have intended to make it public, but may actually not have? I guess it is time to contact the author.

The OP should not ask for help with his code from the author; that is probably why he is not responding. Instead he should state that he is getting an error trying to access a property that the author claims is exposed. A lot of programmers that I know refuse to look at another person's code, just so they do not get hit with copyright issues. (Basically, the attitude is: "If I never saw your code, you cannot later claim that I stole it.")
koganam is offline  
Reply With Quote
The following user says thank you to koganam for this post:
Old 04-25-2012, 05:27 PM   #11
Crassius
Senior Member
 
Join Date: Nov 2008
Posts: 188
Thanks: 38
Thanked 33 times in 27 posts
Default

I made a new indicator to test the two public properties:

Code:
protected override void OnBarUpdate()
        {
           betterSineWaveSine = BetterSinewave(password,true).Sine[0];
            Print(betterSineWaveSine);
            //betterPBTrend = BetterSinePB(Color.Red,password,Color.Green).TrendSeries[0];
//Print(betterPBTrend);
        }
The Sine property works, the TrendSeries property still give sthe error message,

Does not contain definition for...
Crassius is offline  
Reply With Quote
Old 04-25-2012, 05:33 PM   #12
Crassius
Senior Member
 
Join Date: Nov 2008
Posts: 188
Thanks: 38
Thanked 33 times in 27 posts
Default

Quote:
Originally Posted by koganam View Post
Uh oh!! It looks like you are right. And since you are using the FQPN, if that were a public property, that should be accessible. What does Intellisense say? It seems to me that the author may have intended to make it public, but may actually not have? I guess it is time to contact the author.

The OP should not ask for help with his code from the author; that is probably why he is not responding. Instead he should state that he is getting an error trying to access a property that the author claims is exposed. A lot of programmers that I know refuse to look at another person's code, just so they do not get hit with copyright issues. (Basically, the attitude is: "If I never saw your code, you cannot later claim that I stole it.")
read this after my last post...

Yes, I think that is the case.... the property is SUPPOSED to be public but there is an error in the vendors script and that property is not exposed...

I know the vendor, Barry, is not a C# programmer and hired a NinjaScript consultant to translate his original EasyLanguage code, so he wouldn't know if it is exposed properly or not by looking at the code.

I suggest the OP contact Barry and let him know that this has been looked into by more than just the OP and it appears to us that the property is not exposed and is not working as advertised.
Crassius is offline  
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Variables Shannon Brandt Strategy Development 1 10-13-2011 10:40 AM
Variables Italy General Programming 1 11-25-2010 09:47 AM
How to access MACD variables in the Wizard laocoon Strategy Development 9 07-03-2010 12:47 AM
Can I access Public Indicator Variables from Strategy rrv1980 Strategy Development 13 08-24-2008 05:31 PM
Access to price data variables in user defined class svrz Indicator Development 2 05-21-2008 10:48 PM


All times are GMT -6. The time now is 07:55 AM.