Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
Hey everyone, I'm waiting forever for a strategy I bought to be changed to start with both long and short trading switches in the off state instead of them both being on upon enabling the strategy.
Can anyone tell me how to get into the strategy file (I'm guessing the .cs file maybe...), and make the adjustment and save as a new file with the settings changed? Bottom line: I would like to do this as non-invasive and keep the original as backup.
Thanks in advance...
Can you help answer these questions from other members on NexusFi?
First I'm assuming you have source code access included and already have a zip file that was sent to import into NT7 as backup anyway.
I'm also assuming from what you say that the startup condition variable(s) have not been made available in the Strategy Parameters section. You could make them be if so desired.
To start with just use the NT 'Tools->Edit NinjaScript->Strategy' right-mouse menu, find your strategy in the list and open it.
Then do right-mouse-menu -> 'Save As...' and save it under a new name. Your original Strategy will be left untouched.
Find (I'm guessing) the one or two control variables and see if they are either statically initialised (e.g. bool longsOn = true or int longs = 1) or set in Initialise() or OnStartUp() and change them to start as false/0/Off whatever.
Finally just press F5, this will recompile your new Strategy and any other code you have. Close the file and you should be good to go.
Re-edit/F5/find errors as needed, you only need the 'Save As...' step if you want different named versions.
If he can get at the source code, (from the looks of it he can't), but for future reference... just check for the Historical state at the top of OnBarUpdate() forcing an exit until the strategy transitions to the live state. He won't have access to historical performance statistics, but the strategy will always start clean on the first tick of live data, (no virtual positions/orders as a result of the historical state) .
Yeah I'm afraid it must be protected. And I can't find any .cs files with the strategy I need to change. I resorted to using a macro to quickly disable both the long and short buttons as the strategy comes on. But recently even the macro is failing with a message saying, "unable to set the hook". I take it that's some sort of VB or .net issue.
I recently upgraded to windows 10 and lost the ability for any macro programs to work anymore. Ugh..
Yep, that's why I haven't upgraded. I know lots of folks say 10's great but I never do until I buy a new machine to go with it. I think there's a way to restore 7 but I don't know how easy it is.
Yes I do use that quite a lot too, but I think he wants the strategy to go live and then to be able to manually hit the Longs/Shorts On/Off buttons from a default 'Off' state rather than from a default 'On' state.
Yes he's right Trendwave. I wasn't sure what you were advising. But my case is exactly as Ratfink stated.
That's fine. I got an alternate strategy to work the way I want it to and it has all the necessary functionality.