• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Custom serialization

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • NinjaTrader_Jesse
    replied
    Hello,

    If you remove the strategy, it would not reappear the next time you load the workspace or platform. There are no programmatic ways to remove or apply strategies at this time. If you are trying to have it reappear when you start the platform, it would not make sense to remove it.

    If you can provide some detail on what you are trying to do specifically, potentially I could recommend other ideas.

    If you are trying to create some form of a template loading system to your strategy you can, but the default way the platform handles strategies cannot be changed. You would instead need to use attribute tags to prevent items that should not be serialized from being saved. This is the [XmlIgnore] attribute.


    I look forward to being of further assistance.

    Leave a comment:


  • tolisss
    replied
    >A strategy by default will be serialized if it is left in the workspace as this is needed to reapply it later

    this sounds like if I remove the strategy from the workspace it will not be serialized? does it make sense? and if yes would it be possible to custom deserialize it again and add it to the workspace next time is loaded?

    Leave a comment:


  • NinjaTrader_Jesse
    replied
    Hello,

    Thank you for the post.

    You could certainly use C# to serialize an object as you want, you can also prevent properties from being serialized using the [XmlIgnore()] attribute on any properties that should not be serialized. A strategy by default will be serialized if it is left in the workspace as this is needed to reapply it later. You cannot directly disable this but you can disable any custom properties you create and then create logic to save as you wish.

    In this situation, you would likely need to wait for a later state like DataLoaded to set a boolean value to know the script was in fact started and applied, then later in State.Terminated check if the bool was set and then serialize your properties or objects in a way you want.


    I look forward to being of further assistance.

    Leave a comment:


  • tolisss
    started a topic Custom serialization

    Custom serialization

    Hi

    Is it possible to override the default object serialization ? I looking into providing my own serialization strategies without the use of code attributes.

Latest Posts

Collapse

Topics Statistics Last Post
Started by Guru73, Today, 02:47 AM
1 response
3 views
0 likes
Last Post Guru73
by Guru73
 
Started by pjsmith, Today, 02:44 AM
0 responses
1 view
0 likes
Last Post pjsmith
by pjsmith
 
Started by dalebru, Today, 01:51 AM
1 response
4 views
0 likes
Last Post bltdavid  
Started by Austiner87, Yesterday, 09:33 PM
0 responses
9 views
0 likes
Last Post Austiner87  
Started by HiddenPhilosopher, Yesterday, 07:24 PM
0 responses
10 views
0 likes
Last Post HiddenPhilosopher  
Working...
X