NexusFi: Find Your Edge


Home Menu

 





Strategy Wizard Coding Question


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one Big Mike with 3 posts (0 thanks)
    2. looks_two njaisson with 3 posts (0 thanks)
    3. looks_3 revtrader with 1 posts (1 thanks)
    4. looks_4 max-td with 1 posts (0 thanks)
    1. trending_up 4,710 views
    2. thumb_up 1 thanks given
    3. group 2 followers
    1. forum 8 posts
    2. attach_file 1 attachments




 
Search this Thread
  #1 (permalink)
 njaisson 
Madrid
 
Experience: Intermediate
Platform: Ninja
Posts: 15 since Sep 2009
Thanks Given: 0
Thanks Received: 0

Hello!

Using the NT wizard is there a way to flat all the positions taken before I open the strat whenever the time of the opening, so that it does not continue to trade positions taken before I open the strategy?

Many Thanks,

Nicolas


Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
The Week Ahead -- CPI Wednesday With Oil Past $90, PPI L …
Traders Hideout
$12M Ceasefire Contract Goes Disputed as Bandar Abbas St …
Prediction Markets & Event Contracts
After $87M Settles NO: Irans Nuclear Redline Sets Up the …
Prediction Markets & Event Contracts
NYSE Owner ICE Invests in Crypto Exchange OKX at $25 Bil …
Cryptocurrency
CFTC Approves First US Bitcoin Perpetual Futures -- Kals …
Traders Hideout
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Sober Journey With S&P
21 thanks
2026 Jlab journal
10 thanks
Algo automated / semi-automated trading anyone?
6 thanks
Lady Vols Primer: Trading Volatility Journal
6 thanks
Trying to learn Volume and price action correlation
5 thanks
  #2 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,669 since Jun 2009
Thanks Given: 33,669
Thanks Received: 102,557


njaisson View Post
Hello!

Using the NT wizard is there a way to flat all the positions taken before I open the strat whenever the time of the opening, so that it does not continue to trade positions taken before I open the strategy?

Many Thanks,

Nicolas

Not 100% sure this is what you are looking for, but in Control Center, Tools - Options, there is a section for Strategies - NinjaScript:

[img]https://nexusfi.com/v/czf3ga.png[/img]

Set it to "Wait until Flat" to make sure that once you add a strategy to a chart, the strategy will not open a new position until it is flat. In other words, if the strategy "should have been" long 5 bars before you added it to the chart, this will prevent it from thinking it is long and thus royally screwing up your account and getting out of sync.

Mike




We're here to help: just ask the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor
Searching for trading reviews? Review this list
Lifetime Elite Membership: Sign-up for only $149 USD
Exclusive money saving offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Follow me on X Visit my NexusFi Trade Journal Reply With Quote
  #3 (permalink)
 
max-td's Avatar
 max-td 
Frankfurt
 
Experience: Intermediate
Platform: NinjaTrader
Trading: FGBL 6E B4
Posts: 1,752 since Jun 2009
Thanks Given: 2,309
Thanks Received: 927


But Mike, what you show here is NT7 !
that option is not available in NT 6.5.

maybe, nicolas, try to explain a bit better what you are looking for.


max-td
Reply With Quote
  #4 (permalink)
 njaisson 
Madrid
 
Experience: Intermediate
Platform: Ninja
Posts: 15 since Sep 2009
Thanks Given: 0
Thanks Received: 0

Cool man! Thanks for this. I was wondering as well what is the function in the wizard to close the strategy when a certain PnL has been reached. I am asking because I noticed that even if you code that it should exit long or short positions when PnL is inferior or superior to a certain value, it continues to place trades and immediately close them afertwards. This will be my last enquiry, promised!


Started this thread Reply With Quote
  #5 (permalink)
 njaisson 
Madrid
 
Experience: Intermediate
Platform: Ninja
Posts: 15 since Sep 2009
Thanks Given: 0
Thanks Received: 0

Nice results on CL yesterday in automated trading :-))


Attached Thumbnails
Click image for larger version

Name:	CL.jpg
Views:	355
Size:	168.1 KB
ID:	11391  
Started this thread Reply With Quote
  #6 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,669 since Jun 2009
Thanks Given: 33,669
Thanks Received: 102,557


max-td View Post
But Mike, what you show here is NT7 !
that option is not available in NT 6.5.

maybe, nicolas, try to explain a bit better what you are looking for.

The part I highlighted is in 6.5 and is what I was talking about.

Mike




We're here to help: just ask the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor
Searching for trading reviews? Review this list
Lifetime Elite Membership: Sign-up for only $149 USD
Exclusive money saving offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Follow me on X Visit my NexusFi Trade Journal Reply With Quote
  #7 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,669 since Jun 2009
Thanks Given: 33,669
Thanks Received: 102,557


njaisson View Post
Cool man! Thanks for this. I was wondering as well what is the function in the wizard to close the strategy when a certain PnL has been reached. I am asking because I noticed that even if you code that it should exit long or short positions when PnL is inferior or superior to a certain value, it continues to place trades and immediately close them afertwards. This will be my last enquiry, promised!

I've never used the wizard, but to my knowledge you can't do that in the wizard. There are plenty of examples of code on how to do this on the forum, you'll need to learn to code C# directly and forget the wizard.

Mike




We're here to help: just ask the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor
Searching for trading reviews? Review this list
Lifetime Elite Membership: Sign-up for only $149 USD
Exclusive money saving offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Follow me on X Visit my NexusFi Trade Journal Reply With Quote
  #8 (permalink)
 TraderG 
Toronto
 
Experience: Intermediate
Platform: NinjaTrader, TOS
Broker: Rithmic
Trading: CL
Posts: 17 since Aug 2009
Thanks Given: 1
Thanks Received: 9

I am trying to backtest the StochVolTrigger using Strategy wizard to create a simple buy/sell orders. Can someone tell me how I can use the NT wizard to automate a buy or sell when this indicator paints a green or red dot on the chart.


Reply With Quote
  #9 (permalink)
 
revtrader's Avatar
 revtrader 
Harrisburg PA
 
Experience: Advanced
Platform: NT
Frequency: Daily
Duration: Minutes
Posts: 63 since Jul 2009
Thanks Given: 180
Thanks Received: 44

Here is what I use in my strategies

protected override void OnBarUpdate()
{
if (Historical)
return;

I enter this first right under OnBarUpdate. in my code. This will not take any historical trades when applying the strategy to the chart.

Hope this helps


Reply With Quote
Thanked by:




Last Updated on October 6, 2010


© 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