how to write an indicator that enters a trade - futures io
futures io



how to write an indicator that enters a trade


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one forrestang with 4 posts (9 thanks)
    2. looks_two trendisyourfriend with 4 posts (8 thanks)
    3. looks_3 sam028 with 3 posts (3 thanks)
    4. looks_4 vickisb with 3 posts (0 thanks)
      Best Posters
    1. looks_one forrestang with 2.3 thanks per post
    2. looks_two trendisyourfriend with 2 thanks per post
    3. looks_3 sam028 with 1 thanks per post
    4. looks_4 chipwitch with 1 thanks per post
    1. trending_up 2,361 views
    2. thumb_up 22 thanks given
    3. group 5 followers
    1. forum 15 posts
    2. attach_file 1 attachments




Welcome to futures io: the largest futures trading community on the planet, with well over 150,000 members
  • 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 and simple.

-- Big Mike, Site Administrator

(If you already have an account, login at the top of the page)

 
Search this Thread
 

how to write an indicator that enters a trade

(login for full post details)
  #11 (permalink)
 sam028 
Site Moderator
 
 
sam028's Avatar
 
Posts: 3,706 since Jun 2009
Thanks: 3,806 given, 4,556 received


trendisyourfriend View Post
Did you explore the ATM Strategy Methods ? Everything you have mentionned in your last post can be done within a Ninjascript strategy outside of the indicator environment. The strategy and Add-on environments are the suggested way by Ninjatrader for this type of work.

I'm using indicators and orders methods for things which can hardly be done with something else, like adding custom button on the ChartTrader which have risk management functions, or replicate orders from one machine to one or more Ninja located somewhere else, or hedge positions between different accounts/instruments.
So that's far beyond what an ATM can do.

Success requires no deodorant! (Sun Tzu)
Follow me on Twitter Reply With Quote

Can you help answer these questions
from other members on futures io?
NT deleting my Strategies on charts
NinjaTrader
TOS Fold Loop to NT8 For Loop
NinjaTrader
use of Ultimate Oscillator in NT8
NinjaTrader
Pinescript to EL conversion - ema cloud indicator
TradeStation
NT8 - Footprint Chart adding on code
NinjaTrader
 
 
(login for full post details)
  #12 (permalink)
 forrestang 
Urban Samurai
Chicago IL
 
Experience: None
Platform: Ninja, MT4, Matlab
Broker: CQG, AMP, MB, DTN
Trading: E/U, G/U
 
forrestang's Avatar
 
Posts: 1,321 since Jun 2010
Thanks: 346 given, 1,033 received


sam028 View Post
I'm using indicators and orders methods for things which can hardly be done with something else, like adding custom button on the ChartTrader which have risk management functions, or replicate orders from one machine to one or more Ninja located somewhere else, or hedge positions between different accounts/instruments.
So that's far beyond what an ATM can do.

I am new to this, you've obviously been using NT's trade stuffs longer than I have.

But, are you sure you're not confusing the general non-code based, ATM stuff the end user has access to on 'chart trader'... with the ability to use standard NT code to place ATM trades?



I.e.,

Strategy logic is like:
 
Code
if(Close[0] > Open[0])
    EnterLongLimit(int quantity, double limitPrice, string signalName)

ATM logic is like:
 
Code
if(Close[0] > Open[0])
    AtmStrategyCreate(OrderAction action, OrderType orderType, double limitPrice, double stopPrice, TimeInForce timeInForce, string orderId, string strategyTemplateName, string atmStrategyId, Action<Cbi.ErrorCode, string> callback)

Both above actions will place orders into the market. From there, you can do whatever you want w/those orders. Adjust them, cancel them, change them, do something else after filled, access information in other accounts, etc.


In both cases, you accomplish a similar thing, and in both cases you have access to everything in NT's universe... account positions, pnl per trade, all the history of the bars, etc... The primary difference being the ability or ease to manipulate the positions after it is placed.

What would stop you from creating an ATM-based order entry, and still add buttons, hedge, or do whatever else you want to do?

---EDIT----
In thinking about it... one thing I think strategy-logic gives you... is a lot of helper methods/functions created by NT that may make things a bit simpler to create. Using ATM code, I can see how you might need to manually write some of your own helper methods, but I am still wondering what things you CANNOT do w/ATM logic?

E.g., a strategy-logic method is setTrailStop()... to recreate this functionality using ATM-logic, you'd need to write your own trailStop logic, and update your order when necessary.

Reply With Quote
The following 2 users say Thank You to forrestang for this post:
 
(login for full post details)
  #13 (permalink)
 trendisyourfriend 
Market Wizard
Quebec
 
Experience: Intermediate
Platform: NinjaTrader wt Rancho Dinero's profiling tools
Broker: AMP/CQG
Trading: ES, NQ, YM
 
trendisyourfriend's Avatar
 
Posts: 4,182 since Oct 2009
Thanks: 3,861 given, 5,469 received



forrestang View Post
---EDIT----
In thinking about it... one thing I think strategy-logic gives you... is a lot of helper methods/functions created by NT that may make things a bit simpler to create. Using ATM code, I can see how you might need to manually write some of your own helper methods, but I am still wondering what things you CANNOT do w/ATM logic?

E.g., a strategy-logic method is setTrailStop()... to recreate this functionality using ATM-logic, you'd need to write your own trailStop logic, and update your order when necessary.

....

That's my understanding too. Usig ATM-logic the user can still move the orders as he wishes manually while still having the script control them just as well which is not the case with the unmanaged/managed approach.

Reply With Quote
The following 3 users say Thank You to trendisyourfriend for this post:
 
(login for full post details)
  #14 (permalink)
 vickisb 
Sarasota FL
 
Experience: Intermediate
Platform: Ninja Trader
Trading: ES
 
Posts: 31 since Feb 2017
Thanks: 14 given, 12 received

I don't know enough to know how to use this info. Do you have any templates that I could use to copy and tweak?


sam028 View Post
A very partial skeleton but the main methods are here:

private Account myaccount;
...
Order myOrder = new Order();
myOrder = myaccount.CreateOrder(Instrument, ...);
myccount.Submit(new[] { myOrder });


Started this thread Reply With Quote
 
(login for full post details)
  #15 (permalink)
 vickisb 
Sarasota FL
 
Experience: Intermediate
Platform: Ninja Trader
Trading: ES
 
Posts: 31 since Feb 2017
Thanks: 14 given, 12 received

The third-party product I have used to be a strategy, then they reworked it to be an indicator. The advantage I saw right away is that when you manually close the trade you don't have then remember to re-enable the strategy.

I have written strategies that use ATMs. I am interested in a) how to do the same thing within an indicator and b) how to have buttons on the top of the chart to quickly change some of the parameters. Please see the attached screen shot.




trendisyourfriend View Post
Why not use the strategy framework? It is there for this exact reason. With a strategy you can turn it On/Off without reloading your chart.

I have been using these methods with great success and ease.
https://ninjatrader.com/support/helpGuides/nt8/NT%20HelpGuide%20English.html?atmstrategycreate.htm


Started this thread Reply With Quote
 
(login for full post details)
  #16 (permalink)
 trendisyourfriend 
Market Wizard
Quebec
 
Experience: Intermediate
Platform: NinjaTrader wt Rancho Dinero's profiling tools
Broker: AMP/CQG
Trading: ES, NQ, YM
 
trendisyourfriend's Avatar
 
Posts: 4,182 since Oct 2009
Thanks: 3,861 given, 5,469 received


vickisb View Post
The third-party product I have used to be a strategy, then they reworked it to be an indicator. The advantage I saw right away is that when you manually close the trade you don't have then remember to re-enable the strategy.

I have written strategies that use ATMs. I am interested in a) how to do the same thing within an indicator and b) how to have buttons on the top of the chart to quickly change some of the parameters. Please see the attached screen shot.






I would recommand to ask your question directly on the Ninjatrader forum.

https://ninjatrader.com/support/forum/forum/ninjatrader-8/indicator-development/1134941-looking-to-add-order-entry-buttons-to-chart-trader

Reply With Quote


futures io Trading Community Platforms and Indicators NinjaTrader > how to write an indicator that enters a trade


Last Updated on June 8, 2022


Upcoming Webinars and Events
 

NinjaTrader Indicator Challenge!

Ongoing
     



Copyright © 2022 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada), info@futures.io
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.
no new posts