NexusFi: Find Your Edge


Home Menu

 





Strategy Help


Discussion in NinjaTrader

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




 
Search this Thread

Strategy Help

  #1 (permalink)
 
gretzkyless's Avatar
 gretzkyless 
Chicago, IL/USA
 
Experience: Intermediate
Platform: Ninja Trader
Broker: AMP Trading - CQG/ThinkorSwim
Trading: Futures
Posts: 30 since Jan 2013
Thanks Given: 13
Thanks Received: 19

Hello everyone. I'm pretty new to this site and from what I have found, this is a pretty good site to learn how to develop your own code. I have attached a very simple code that I created through Ninjatrader's Ninjascript editor using the slow moving average to trigger into a trade. I'm just trying to get a feel for how code looks and was surprised when I back-tested and saw that I wasn't triggered into a trade everytime the moving averages crossed. Additionally, the trailing stop doesn't seem to be working correctly either. I have attached the unlocked code here for any help you can provide.

Here is what I'm trying to accomplish with this strategy:

Get triggered into a trade when the small trigger lines cross above/below and the large trigger lines cross above/below each other. If filled, the have exit at 10 ticks and the second have a trailing stop of 15 ticks with a 50 tick profit target.

The other problem I'm having, which I think additional code would need to be written to do this, is to not reverse a trade I'm in even though the slow and fast cross. I know there will be resting periods before the trend continues and don't want to have extra trades triggered. Basically, I would like to cut out the noise when the instrument is clearly moving one direction. First trying to get the code correct for the first part. Any help would be greatly appreciated. Thanks.

Attached Files
Elite Membership required to download: AutoTradeStrategy1.cs
Follow me on Twitter Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Quant vue
Trading Reviews and Vendors
Trade idea based off three indicators.
Traders Hideout
MC PL editor upgrade
MultiCharts
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
Better Renko Gaps
The Elite Circle
 
  #3 (permalink)
 
gretzkyless's Avatar
 gretzkyless 
Chicago, IL/USA
 
Experience: Intermediate
Platform: Ninja Trader
Broker: AMP Trading - CQG/ThinkorSwim
Trading: Futures
Posts: 30 since Jan 2013
Thanks Given: 13
Thanks Received: 19


ok. figured out first part, on to second part.

Follow me on Twitter Started this thread Reply With Quote
  #4 (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,463 since Jun 2009
Thanks Given: 33,236
Thanks Received: 101,660

Please use this thread only instead of double/cross posting.

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 Twitter Visit my NexusFi Trade Journal Reply With Quote
  #5 (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,463 since Jun 2009
Thanks Given: 33,236
Thanks Received: 101,660

There is a great deal of strategy code on the forum, but almost all of it is in Elite section. You can look at the Elite Automated forums for group projects and code, and the Battle of the Bots thread. Within those threads will be dozens and dozens of examples for trade management.

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 Twitter Visit my NexusFi Trade Journal Reply With Quote




Last Updated on January 24, 2013


© 2024 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 - Privacy Policy - Downloads - Top
no new posts