NexusFi: Find Your Edge


Home Menu

 





Active GeoKing - Triple Auto Swing Indicator for NT8


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one Marty087 with 19 posts (91 thanks)
    2. looks_two zt379 with 10 posts (11 thanks)
    3. looks_3 shortski with 8 posts (1 thanks)
    4. looks_4 Conceptzx with 7 posts (0 thanks)
      Best Posters
    1. looks_one Marty087 with 4.8 thanks per post
    2. looks_two trendisyourfriend with 3 thanks per post
    3. looks_3 zt379 with 1.1 thanks per post
    4. looks_4 Chof with 0.5 thanks per post
    1. trending_up 7,753 views
    2. thumb_up 113 thanks given
    3. group 28 followers
    1. forum 51 posts
    2. attach_file 18 attachments




 
 

Active GeoKing - Triple Auto Swing Indicator for NT8

 
 zt379 
UK London
Market Wizard
 
Platform: NT
Posts: 2,083 since Sep 2009
Thanks Given: 1,590
Thanks Received: 2,000

@Marty087

Hello.

I wanted to have the trendlines coloured for Up and Down.

I managed to adjust the code (making a "my version" copy) for any one interested.

Any verification the code changes I made (to My Version) are correct would be welcome and/or perhaps think about adding it to any future versions.









In On State Change I added for Up and Dn colours at line 490:

 
Code
TrendLineColor  	= Brushes.Blue;
TrendLineColorUp    = Brushes.Blue;
TrendLineColorDn    = Brushes.Red;






Then in TrendLines at line 5659 I added "Up" to "TrenLineColor":

 
Code
Draw.Ray(this,"TL-LowTL"+x+" id ="+id+ "y ="+y, false,SWLB[id,2+x+y], SWLow[id,2+x+y], SWLB[id,1+x], SWLow[id,1+x], TrendLineColorUp,DashStyleTL, LineWidthTrendLine);

Then added "Dn" at line 5691:

 
Code
Draw.Ray(this,"TL-HighTL"+x+" id ="+id+ "y ="+y,false, SWHB[id,2+x+y], SWHigh[id,2+x+y], SWHB[id,1+x], SWHigh[id,1+x], TrendLineColorDn,DashStyleTL, LineWidthTrendLine);


Then added "Up" to "TrendLine" at line 5709:
 
Code
Draw.Ray(this,"TL-Lows TrendLine", false, LBtwoIdx, Low[LBtwoIdx], LBoneIdx, Low[LBoneIdx], TrendLineColorUp ,DashStyleTL , LineWidthTrendLine);


Then added "Dn" to "TrendLine" at line 5714:

 
Code
Draw.Ray(this,"TL-Highs TrendLine", false, HBtwoIdx,HigH(HBtwoIdx), HBoneIdx,HigH(HBoneIdx), TrendLineColorDn ,DashStyleTL, LineWidthTrendLine);


Then I copy/pasted the Trendline properties from line 8726 and added Properties for "TrendLineColorUp" and "TrendLineColorDn":

 
Code
 
[XmlIgnore]
[NinjaScriptProperty]
[Display(ResourceType = typeof(Custom.Resource), Name = "TrendLineColor", GroupName="(2.a) Plot Colors", Order = 0)]
public Brush TrendLineColor { get; set; }
		
[Browsable(false)]
public string TrendLineColorSerialize
{
 get { return Serialize.BrushToString(TrendLineColor); }
 set { TrendLineColor = Serialize.StringToBrush(value); }
}





[XmlIgnore]
[NinjaScriptProperty]
[Display(ResourceType = typeof(Custom.Resource), Name = "Trend Line Color Up", GroupName="(2.a) Plot Colors", Order = 0)]
public Brush TrendLineColorUp { get; set; }
		
[Browsable(false)]
public string TrendLineColorUpSerialize
{
 get { return Serialize.BrushToString(TrendLineColorUp); }
set { TrendLineColorUp = Serialize.StringToBrush(value); }
		}	
					
[XmlIgnore]
[NinjaScriptProperty]
[Display(ResourceType = typeof(Custom.Resource), Name = "Trend Line Color Dn", GroupName="(2.a) Plot Colors", Order = 0)]
public Brush TrendLineColorDn { get; set; }
		
[Browsable(false)]
public string TrendLineColorDnSerialize
{
get { return Serialize.BrushToString(TrendLineColorDn); }
set { TrendLineColorDn = Serialize.StringToBrush(value); }
}


I didn't comment out the original Trendline Properties as this is referenced elsewhere in the code and it seems to still work.


Many thanks

Thanked by:

Can you help answer these questions
from other members on NexusFi?
About a successful futures trader who didnt know anythin …
Psychology and Money Management
Quantum physics & Trading dynamics
The Elite Circle
What broker to use for trading palladium futures
Commodities
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
REcommedations for programming help
Sierra Chart
 
 
 zt379 
UK London
Market Wizard
 
Platform: NT
Posts: 2,083 since Sep 2009
Thanks Given: 1,590
Thanks Received: 2,000

As an update to my last post and the TrendLine Colours I added, I'm getting the following Error when I save as a chart template having saved the indicator to the chart.

I'm not experienced enough to know what the issue is although the indicator as adjusted runs
without issue.

Any help or suggestions appreciated in the absence of the man from down under. Hopefully he's busy putting in the cappuccino settings.






Many thanks

 
 
trendisyourfriend's Avatar
 trendisyourfriend 
Quebec Canada
Market Wizard
 
Experience: Intermediate
Platform: NinjaTrader
Broker: AMP/CQG
Trading: ES, NQ, YM
Frequency: Daily
Duration: Minutes
Posts: 4,527 since Oct 2009
Thanks Given: 4,176
Thanks Received: 6,020



zt379 View Post
As an update to my last post and the TrendLine Colours I added, I'm getting the following Error in output window and when I load the chart template having saved the indicator to the chart.

I'm not experienced enough to know what the issue is although the indicator as adjusted runs
all be it using a lot more system resources than it should (for reasons of the error.

Any help or suggestions appreciated in the absence of the man from down under. Hopefully he's busy putting in the cappuccino settings.






Many thanks

Here are a few possible causes for this error which i posted in another place:

Uninitialized Object: my script might have declared a variable but i forgot to instantiate it with the 'new' keyword. For example:

 
Code
SomeClass obj;
obj.DoSomething(); // Throws the "Object reference not set to an instance of an object" error
To fix this, we typically need to initialize the object using the 'new' keyword:
 
Code
SomeClass obj = new SomeClass();
obj.DoSomething(); // Now it should work fine
Null Assignment: my script might have assigned a null value to an object reference, and then tried to use it. For example:
 
Code
SomeClass obj = null;
obj.DoSomething(); // Throws the "Object reference not set to an instance of an object" error
To fix this, i need to assign a valid instance to the object reference before using it:
 
Code
SomeClass obj = new SomeClass(); // Or assign an existing instance from elsewhere
obj.DoSomething(); // Now it should work fine
Null Return Value: my script might be calling a method or property that returns null, and then trying to access a member of that returned value. For example:
 
Code
SomeClass obj = GetSomeClassInstance();
obj.DoSomething(); // Throws the "Object reference not set to an instance of an object" error
To fix this, i should check if the returned value is null before accessing its members:
 
Code
SomeClass obj = GetSomeClassInstance();
if (obj != null)
{
    obj.DoSomething(); // Now it should work fine
}
These are just a few common scenarios that can cause the "Object reference not set to an instance of an object" error.

As you can see, it is not a small job to correct or pinpoint this problem as Ninjatrader does not help you much.

 
 zt379 
UK London
Market Wizard
 
Platform: NT
Posts: 2,083 since Sep 2009
Thanks Given: 1,590
Thanks Received: 2,000

@trendisyourfriend

Hello.
Thanks for your help, much appreciated.

The error message I posted only comes up when I save the chart as a template and doesn't refer to TrenLineColorUp" or "TrendLineColorDn" but for "TrenLineColor" the settings for which I didn't alter at all. I don't get the error if saving as a chart template with the original indicator.

I can't see where I could make any of the suggestions you gave, meaning I should only needed to have added the code in OnStateChange and Properties, which I did and posted earlier. Although I'm clearly missing something. Non the less thank you again for taking the time to help.

Additionally to the error message I posted I get the following listed in NT Output for both "My Version" and the original. It's referring to "CalDailyLevels". I don't think this is caused by my additions, perhaps something @Marty085 is still working on.






As it stands the trendline colour changes I made are working.

Hopefully @Marty087 will be able to verify.



I also hope this isn't interfering with the thread. If so and as and when the code changes have been verified I have no objection to my posts here being removed.

Many thanks

Thanked by:
 
 Marty087 
Sydney NSW Australia
 
Experience: Intermediate
Platform: Ninjatrader 7 / MT4
Broker: KINETICK
Trading: EUR/USD, AUS200(SPI)
Posts: 40 since May 2012
Thanks Given: 15
Thanks Received: 100


zt379 View Post
@Marty087

Greetings.

Two requests or suggestions if I may:

1) I'd like to change the colours of the SML MED LRGE letters at top right, either via editing your code (although I couldn't find where) or if possible the option can be included in indicator settings. I couldn't see this in the existing indicator settings.

As they are it's difficult for me to see against certain chart background colours. (getting old)




2) Just a thought. An option (if at all possible) to have the tiles positioned at the left of the chart. So it would create a letter "L" shape at the left side of the chart. Alternatively a button on the NT menu title bar (top of chart) to toggle On/Off the entire tile display.

Many thanks again for your work and contribution.

Hey @zt379

Thanks for your interest, glad you are getting some use out of it.

See the latest download. Color options are added in the indicator properties as "TrendColorUp" and "TrendColorDn".

What do you mean about the "Tiles" ?

Cheers.

Started this thread
Thanked by:
 
 Marty087 
Sydney NSW Australia
 
Experience: Intermediate
Platform: Ninjatrader 7 / MT4
Broker: KINETICK
Trading: EUR/USD, AUS200(SPI)
Posts: 40 since May 2012
Thanks Given: 15
Thanks Received: 100

Glad to see activity in the thread, by the way, feel free!


I've also added TrendLine colors in the latest version.

Looking at your code changes, they all look right. I pretty much replicated them and didn't have issues.

The screenshot of the indicator properties you shared shows that TrendLineColor has no assigned color, this is likely the issue.

 
Code
TrendLineColor  	= Brushes.Blue;

The line above that you have retained should ensure the color var is initiated and therefore shouldn't be showing blank in the indi properties. Maybe double-check that line is still intact?

In any case, the new version has the TL changes anyway, I'm just curious now.





zt379 View Post
@Marty087

Hello.

I wanted to have the trendlines coloured for Up and Down.

I managed to adjust the code (making a "my version" copy) for any one interested.

Any verification the code changes I made (to My Version) are correct would be welcome and/or perhaps think about adding it to any future versions.


Started this thread
Thanked by:
 
 Marty087 
Sydney NSW Australia
 
Experience: Intermediate
Platform: Ninjatrader 7 / MT4
Broker: KINETICK
Trading: EUR/USD, AUS200(SPI)
Posts: 40 since May 2012
Thanks Given: 15
Thanks Received: 100


Jae2jin View Post
I just want to say thank you again for your work and it being free for us traders.

I wanted too ask if it is possible to have the option to add price text of the trend lines and option too make the text biggger

but i want to say thank you again for this great indicator


Hey Jae2jin,

For some reason, I am really struggling with font-based public properties, probably why I shortcutted this a couple of years ago and hardcoded the size.

See the below code at line 276. Change the "Size = 14" t0 "Size = 18" or larger for a quick fix for larger text.

 
Code
NinjaTrader.Gui.Tools.SimpleFont FontSizeTmp = new NinjaTrader.Gui.Tools.SimpleFont("Helvetica", 12) { Size = 14, Bold = false };
The TL prices are a good idea, although there is some work in that, Ill let you know if I get to it. Cheers.

Started this thread
 
 zt379 
UK London
Market Wizard
 
Platform: NT
Posts: 2,083 since Sep 2009
Thanks Given: 1,590
Thanks Received: 2,000


Marty087 View Post
Hey @zt379

Thanks for your interest, glad you are getting some use out of it.

See the latest download. Color options are added in the indicator properties as "TrendColorUp" and "TrendColorDn".

What do you mean about the "Tiles" ?

Cheers.

Excellent. Many thanks.

Btw on the download page it would be a good idea to edit the text to give a date each update's been made, other than looking at the version number it's hard to know.

Re: the V1004 number, when downloading the zip it's still named V1002.




Re:

Quoting 
What do you mean about the "Tiles" ?


These which I thought were mentioned as Tiles.
Perhaps an option to toggle them Off/On only to free up chart space when not needing click on them.


 
 Marty087 
Sydney NSW Australia
 
Experience: Intermediate
Platform: Ninjatrader 7 / MT4
Broker: KINETICK
Trading: EUR/USD, AUS200(SPI)
Posts: 40 since May 2012
Thanks Given: 15
Thanks Received: 100

Yes, NexusFi is Glitching. The filename I uploaded is v1004, but downloads as v1002. The contents are consistent with V1004 though so the changes should be there, go figure.

I see what you mean by the tiles/butttons. Prob a massive job, Toggle on/off might be easier, I think I had it at one stage. Im out for the day anyway, thinking about that is for another day.

Happy trading.





zt379 View Post
Excellent. Many thanks.

Btw on the download page it would be a good idea to edit the text to give a date each update's been made, other than looking at the version number it's hard to know.


These which I thought were mentioned as Tiles.
Perhaps an option to toggle them Off/On only to free up chart space when not needing click on them.


Started this thread
Thanked by:
 
 zt379 
UK London
Market Wizard
 
Platform: NT
Posts: 2,083 since Sep 2009
Thanks Given: 1,590
Thanks Received: 2,000



Marty087 View Post
Glad to see activity in the thread, by the way, feel free!


I've also added TrendLine colors in the latest version.

Looking at your code changes, they all look right. I pretty much replicated them and didn't have issues.

The screenshot of the indicator properties you shared shows that TrendLineColor has no assigned color, this is likely the issue.

 
Code
TrendLineColor  	= Brushes.Blue;

The line above that you have retained should ensure the color var is initiated and therefore shouldn't be showing blank in the indi properties. Maybe double-check that line is still intact?

In any case, the new version has the TL changes anyway, I'm just curious now.

Yes I also noticed the blank space in settings for the original TrendlineColor.
I've checked as you suggested and I've not changed anything from the original except to the colour "Blue".

I have these (var) in OnStateChange although I see you've removed the original "TrendLineColor" in your latest V1004.
So these seem correct and should mean it's not blank in settings for "TrendLineColor"

 
Code
TrendLineColor  	= Brushes.Blue;
TrendLineColorUp    = Brushes.Blue;///added
TrendLineColorDn    = Brushes.Red;///added

If I remove from My Version the var for TrendLineColor and the TrendLineColorUp and TrendLineColorDn in Properties (which you've also removed from V1004) I get this Compile error for line 1485 so I left them in:





With your latest V1004 I guess this isn't relevant now but curious none the less as you say.

Again sincere thanks for the additions.


 



Last Updated on February 15, 2024


© 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