NexusFi: Find Your Edge


Home Menu

 





Custom expandable class issue


Discussion in NinjaTrader

Updated
    1. trending_up 1,985 views
    2. thumb_up 0 thanks given
    3. group 1 followers
    1. forum 1 posts
    2. attach_file 0 attachments




 
Search this Thread
  #1 (permalink)
 robsol 
Czech Republic
 
Experience: Beginner
Platform: NinjaTrader
Trading: Futures
Posts: 3 since Aug 2012
Thanks Given: 0
Thanks Received: 0

Hello all, I dont really know what to do I made my custom class RangeCondition and I want it to be expandable in PropertyGrid in Parameters window. I think I done it. But in a LOG I have the same error after compiling and refresh it (just for the first time after compile). And this property doesnt remeber its value Would you be so king and help me somehow ??

Code:
[TypeConverterAttribute(typeof(ExpandableObjectConverter))]
[Serializable()]
public class RangeCondition: ISerializable
{
private OF_OperatorType condoperator = OF_OperatorType.NoOperator; // enumerator defined above
private OF_ConditionType condtype = OF_ConditionType.OpositeSideDiagonally; // enumerator defined above
private double multiplier = 1;
private int increment = 0;
private int condvalue = 0;
public NinjaTrader.Indicator.Indicator Reference = null;


public RangeCondition() {
Operator = OF_OperatorType.NoOperator;
Type = OF_ConditionType.OpositeSideDiagonally;
Multiplier = 1;
Increment = 0;
Value = 0;
}


public override string ToString()
{
string rtn = "no condition";
if (condoperator!=OF_OperatorType.NoOperator) {
rtn = "Number ";
} else {
return rtn;
}

if (condoperator==OF_OperatorType.GreaterThan) rtn+= "> ";
if (condoperator==OF_OperatorType.GreaterThanOrEqualTo) rtn+= ">= ";
if (condoperator==OF_OperatorType.LessThan) rtn+= "< ";
if (condoperator==OF_OperatorType.LessThanOrEqualTo) rtn+= "<= ";

if (condtype==OF_ConditionType.OpositeSide) rtn+= "OS";
if (condtype==OF_ConditionType.AvgTradesPerPeriod) rtn+= "AvgTPP";
if (condtype==OF_ConditionType.Value) rtn+= condvalue+"";

if (Multiplier>1) rtn+= "*"+Multiplier;
if (Increment>0) rtn+= "+"+Increment;

return rtn;
}


public void GetObjectData(SerializationInfo serInfo, StreamingContext context)
{
serInfo.AddValue("Operator",Operator);
serInfo.AddValue("Type",Type);
serInfo.AddValue("Multiplier",Multiplier);
serInfo.AddValue("Increment",Increment);
serInfo.AddValue("Value",Value);
}

private RangeCondition(SerializationInfo serInfo,StreamingContext context)
{
this.Operator = (OF_OperatorType)Enum.Parse(typeof(OF_OperatorType), serInfo.GetString("Operator"));
this.Type = (OF_ConditionType)Enum.Parse(typeof(OF_ConditionType), serInfo.GetString("Type"));
this.Value = serInfo.GetInt32("Value");
this.Increment = serInfo.GetInt32("Increment");
this.Multiplier = serInfo.GetDouble("Multiplier");
}
.
.
.
and so on
}

Error text:
Failed to set property 'R1_Condition1' for indicator 'TestIndicator':
Object of type RangeCondition cannot be converted to type RangeCondition.


Is it a problem of serialization or WHAT ???
I would appreciate any help.
Thank you very much.

RS


Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Bookmap Global Plus Lifetime + Lifetime Addons For Sale
Platforms and Indicators
One Wallet Made $200K in Hours: AP Probes Polymarket Cea …
Prediction Markets & Event Contracts
Saylors 41-Month HODL Breaks: Strategy Sells 32 BTC as $ …
Prediction Markets & Event Contracts
CME Launches Bitcoin Volatility Futures June 1 -- First …
Cryptocurrency
Kharg Island at 6%, Regime Fall at 1.5% -- The Black Swa …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Sober Journey With S&P
24 thanks
2026 Jlab journal
10 thanks
Lady Vols Primer: Trading Volatility Journal
8 thanks
Algo automated / semi-automated trading anyone?
6 thanks
Trying to learn Volume and price action correlation
5 thanks




Last Updated on November 30, 2014


© 2026 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 - Downloads - Top
no new posts