Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Show PnL next to Active Trade markers in Chart Trader
Collapse
X
-
Originally posted by NinjaTrader_ChelseaB View PostHello dj22522,
The point of the indicator was to identify the atm that the stop is part of and label it.
I highly welcome you to create your own indicator with the changes you desire and upload this to the User App Share.
https://ninjatrader.com/support/foru...app-submission
Please let me know if you stuck making any of the changes.
Thank you for your reply.
I had to delete the previous version of the indicator I had installed otherwise the version you posted wouldn't import.
Once I imported your version I would ordinarily use "Save As" to rename and create a copy to work on, however doing that with the indicator you attached throws up compile errors so I'm unable to even try to add the items I listed.
Renaming it to "AtmStrategyIdentifierMyVersion1" creates error: "The best overload match" etc.. and "Cannot convert from" etc...
Code:propertyDescriptorCollection.Add(new AtmStrategyIdentifierMyVersion1Tools.ReadOnlyDescriptor(indicator, toggleValue1));
However now I don't have the initial version I tried to add Adnokers code to (having needing to delete it) so I'm at a bit of a loss how to proceed.
Many thanksLast edited by dj22522; 02-10-2023, 07:55 AM.
Comment
-
Hello dj22522,
The custom namespace at the bottom AtmStrategyIdentifierTools needs to be renamed to YourIndicatorNameTools, and any references to it updated.
(That is most likely the issue)
Below is a link to a video demonstrating.
A similar issue occurs when making a copy of the CandleStickPattern, SampleUniversalMovingAverage, etc.Chelsea B.NinjaTrader Customer Service
Comment
-
NinjaTrader_ChelseaB
Thanks for your reply and efforts.
Unfortunately I get the same compile error even though all instances of the name have been changed.
I'm assuming I keep the word "Tools" at the end of each instance of "AtmStrategyIdentifierMyVersion1Tools" because when I tried deleting "Tools" and only having "AtmStrategyIdentifierMyVersion1" I got many more compile errors.
PS: I deleted your version and re-imported the original and tried to add Adnoker code but I still get compile errors to do with "ticksize" and "pointvalue" and a few others.
None the less thanks to you both.
If Adnoker is able to attach a zip of what they have, that would be greatly appreciated.
Many thanksLast edited by dj22522; 02-10-2023, 09:07 AM.
Comment
-
Hello dj22522,
What is the code on line 494?
It appears something is still referencing AtmStrategyIdentifier.
I see you chose to keep the original name and add on to this instead of using a completely different name. Thats fine to do, but can make find and replace tricky.Chelsea B.NinjaTrader Customer Service
Comment
-
Hi NinjaTrader_ChelseaB
The code at line (now) 516 (was at line 494) is:-
Code:propertyDescriptorCollection.Add(new AtmStrategyIdentifierMyVersion1Tools.ReadOnlyDescriptor(indicator, toggleValue1));
Yes I simply added "My Version 1" to the original name.
PS: Unrelated to what were discussing, when using your version of the indicator and when the stop loss is hit, the text for the profit targets remain on the chart and needs chart refresh to remove them or they're removed on the next trade when an ATM is applied. The same if the profit target/s are hit then the text for stop loss remains on the chart.
Many thanksLast edited by dj22522; 02-10-2023, 09:53 AM.
Comment
-
Hello dj22522,
So appears to be an issue with the ReadOnlyDescriptor.
May I see where AtmStrategyIdentifierMyVersion1Tools.ReadOnlyDescr iptor is defined? This is near the bottom in the region 'Hide/Show AutoScalePadding tools'.
I want to see its in the correct namespace and in the GetValue() / SetValue() overrides and ComponentType getter does not reference the original script.
Also, this typeconverter is just extra. It's all there to make the AutoScalePadding input disabled when AutoScale is unchecked. It's a lot of code for a behavior that isn't vital to the functionality of the script. You could condsider removing the typeconverter if you wanted.Chelsea B.NinjaTrader Customer Service
Comment
-
NinjaTrader_ChelseaB
Here is the code from "region Hide/Show AutoScalePadding tools" down to "endregion" just before "BrushWrapping"
Code:} #region Hide/Show AutoScalePadding tools // This is a custom PropertyDescriptor class which will handle setting our desired properties to read only public class ReadOnlyDescriptor : PropertyDescriptor { // Need the instance on the property grid to check the show/hide toggle value private NinjaTrader.NinjaScript.Indicators.AtmStrategyIdentifierMyVersion1 indicatorInstance; private PropertyDescriptor property; // The base instance constructor helps store the default Name and Attributes (Such as DisplayAttribute.Name, .GroupName, .Order) // Otherwise those details would be lost when we converted the PropertyDescriptor to the new custom ReadOnlyDescriptor public ReadOnlyDescriptor(NinjaTrader.NinjaScript.Indicators.AtmStrategyIdentifierMyVersion1 indicator, PropertyDescriptor propertyDescriptor) : base(propertyDescriptor.Name, propertyDescriptor.Attributes.OfType<Attribute>().ToArray()) { indicatorInstance = indicator; property = propertyDescriptor; } // Stores the current value of the property on the indicator public override object GetValue(object component) { NinjaTrader.NinjaScript.Indicators.AtmStrategyIdentifierMyVersion1 targetInstance = component as NinjaTrader.NinjaScript.Indicators.AtmStrategyIdentifierMyVersion1; if (targetInstance == null) return null; switch (property.Name) { case "AutoScalePadding": return targetInstance.AutoScalePadding; } return null; } // Updates the current value of the property on the indicator public override void SetValue(object component, object value) { NinjaTrader.NinjaScript.Indicators.AtmStrategyIdentifierMyVersion1 targetInstance = component as NinjaTrader.NinjaScript.Indicators.AtmStrategyIdentifierMyVersion1; if (targetInstance == null) return; switch (property.Name) { case "AutoScalePadding": targetInstance.AutoScalePadding = (int) value; break; } } // set the PropertyDescriptor to "read only" based on the indicator instance input public override bool IsReadOnly { get { return !indicatorInstance.IncludeAutoScale; } } // IsReadOnly is the relevant interface member we need to use to obtain our desired custom behavior // but applying a custom property descriptor requires having to handle a bunch of other operations as well. // I.e., the below methods and properties are required to be implemented, otherwise it won't compile. public override bool CanResetValue(object component) { return true; } public override Type ComponentType { get { return typeof(NinjaTrader.NinjaScript.Indicators.AtmStrategyIdentifierMyVersion1); } } public override Type PropertyType { get { return typeof(int); } } public override void ResetValue(object component) { } public override bool ShouldSerializeValue(object component) { return true; } } #endregion
When removing the above section of code I get the following "ReadOnly/Descriptor" compile error:
and the code at line 516:
Code:propertyDescriptorCollection.Add(new AtmStrategyIdentifierMyVersion1MyVersion1Tools.ReadOnlyDescriptor(indicator, toggleValue1));
Last edited by dj22522; 02-10-2023, 10:20 AM.
Comment
-
-
Hello dj22522,
I am seeing the error:
"AtmStrategyIdentifierMyVersion1.cs The type or namespace name 'AtmStrategyIdentifierMyVersion1' does not exist in the namespace 'NinjaTrader.NinjaScript.Indicators' (are you missing an assembly reference?) CS0234 534 52"
This error means there is no indicator with the name AtmStrategyIdentifierMyVersion1.
Your indicator class has the name AtmStrategyIdentifierMyVersion1MyVersion1. These are not the same.Chelsea B.NinjaTrader Customer Service
Comment
-
Hello dj22522,
The error message pasted above has this on line 534.
Are you not able to see this error on your end? The error message has the line number.
To help you understand the error, you are trying to reference an indicator named AtmStrategyIdentifierMyVersion1.
private NinjaTrader.NinjaScript.Indicators.AtmStrategyIdentifierMyVersion1 indicatorInstance;
There is no indicator with this name. Your indicator class has a different name. Use the name of your indicator class.
On line 26, you have named the indicator
public class AtmStrategyIdentifierMyVersion1MyVersion1 : IndicatorChelsea B.NinjaTrader Customer Service
Comment
-
OK thank you.
Line 26 did have incorrect name "MyVersion1MyVersion1" but I don't know how it got there. Perhaps it occurred when I used the "Find" facility you kindly posted a video for.
My apologies and sincere thanks for your time and patience.
Although after all of this I'm not sure I have the skill to create the additions I first mentioned in post 15.
Again my thanks
PS; I deleted some posts as they weren't needed now and to not clutter the thread. Hope that's OK.Last edited by dj22522; 02-10-2023, 12:07 PM.
Comment
-
NinjaTrader_ChelseaB
The text for the Stop Loss and/or Profit targets aren't removed when the trades are filled.
To remove the text from last trade I have to hit F5 or when ATM is applied again (new trade)
Ps: If I exit the trade via the Close button on Chart Trader then the text does remove itself.
Many thanks[/QUOTE]Last edited by dj22522; 02-14-2023, 10:24 AM.
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by gravdigaz6, Today, 11:40 PM
|
0 responses
2 views
0 likes
|
Last Post
by gravdigaz6
Today, 11:40 PM
|
||
Started by MarianApalaghiei, Today, 10:49 PM
|
3 responses
9 views
0 likes
|
Last Post Today, 11:33 PM | ||
Started by XXtrader, Today, 11:30 PM
|
0 responses
3 views
0 likes
|
Last Post
by XXtrader
Today, 11:30 PM
|
||
Started by love2code2trade, Yesterday, 01:45 PM
|
4 responses
28 views
0 likes
|
Last Post Today, 10:31 PM | ||
Started by funk10101, Today, 09:43 PM
|
0 responses
9 views
0 likes
|
Last Post
by funk10101
Today, 09:43 PM
|
Comment