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)
  #1 (permalink)
 vickisb 
Sarasota FL
 
Experience: Intermediate
Platform: Ninja Trader
Trading: ES
 
Posts: 31 since Feb 2017
Thanks: 14 given, 12 received

I have a 3rd party indicator that auto-trades. I didn't realize you could do that with an indicator instead of a strategy. I'm a hack, but have written both. How would I write an indicator that trades? Is it as simple as putting the commands in an indicator instead of a strategy?

And then how would I put some of the parameters on the screen as buttons, e.g., On/Off, Long, Short, ATM to use, etc, so I can change them on the fly?

If anyone has one I could use as a model, I would appreciate getting my hands on it!

Vicki

Started this thread Reply With Quote

Can you help answer these questions
from other members on futures io?
NT8 - Footprint Chart adding on code
NinjaTrader
TOS Fold Loop to NT8 For Loop
NinjaTrader
use of Ultimate Oscillator in NT8
NinjaTrader
NT deleting my Strategies on charts
NinjaTrader
 
 
(login for full post details)
  #2 (permalink)
 sam028 
Site Moderator
 
 
sam028's Avatar
 
Posts: 3,706 since Jun 2009
Thanks: 3,806 given, 4,556 received


vickisb View Post
I have a 3rd party indicator that auto-trades. I didn't realize you could do that with an indicator instead of a strategy. I'm a hack, but have written both. How would I write an indicator that trades? Is it as simple as putting the commands in an indicator instead of a strategy?

And then how would I put some of the parameters on the screen as buttons, e.g., On/Off, Long, Short, ATM to use, etc, so I can change them on the fly?

If anyone has one I could use as a model, I would appreciate getting my hands on it!

Vicki

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 });

Success requires no deodorant! (Sun Tzu)
Follow me on Twitter Reply With Quote
The following 3 users say Thank You to sam028 for this post:
 
(login for full post details)
  #3 (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


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

Reply With Quote
The following 5 users say Thank You to trendisyourfriend for this post:
 
(login for full post details)
  #4 (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

I've never tried sticking any of the ATM methods into an indicator? I JUST started playing with the NT provided ATM framework myself a few days ago, so my knowledge is limited.

But, if you want to be able to manipulate orders on the fly, you will want to create orders with the ATM methods as suggested by trendisyourfriend.

I have a similar thing working right now, but I'm still working on it. It simply places and replaces orders in a range. But I have it in a strategy, not an indicator.

Typicaly strategies, do not allow you to manipulate orders after they are placed, its all run internally by the strategy. But orders created via ATM methods allow you to manipulate the orders.

Reply With Quote
The following 3 users say Thank You to forrestang for this post:
 
(login for full post details)
  #5 (permalink)
 chipwitch 
Nashville, TN
 
Experience: Beginner
Platform: NinjaTrader
Broker: NinjaTrader, Continuum Data
Trading: MES for now... baby steps
 
chipwitch's Avatar
 
Posts: 320 since Feb 2022
Thanks: 229 given, 595 received


forrestang View Post
I've never tried sticking any of the ATM methods into an indicator? I JUST started playing with the NT provided ATM framework myself a few days ago, so my knowledge is limited.

But, if you want to be able to manipulate orders on the fly, you will want to create orders with the ATM methods as suggested by trendisyourfriend.

I have a similar thing working right now, but I'm still working on it. It simply places and replaces orders in a range. But I have it in a strategy, not an indicator.

Typicaly strategies, do not allow you to manipulate orders after they are placed, its all run internally by the strategy. But orders created via ATM methods allow you to manipulate the orders.

I'm 99% sure you cannot do ATM trades from within a script. You can do what they call "managed" or "unmanaged" trades in a script. You can do a bracket pretty easily with managed trail stops (using the NT method) or stop limits and targets. If you want to change an order, for example, that will be an unmanaged trade and they warn only experienced coders should do these. There's actually a lot to it if you think about it... every order needs to wait for the confirm and then consider that before "closing" a position lest you actually be opening one instead. That sort of thing.

Reply With Quote
The following user says Thank You to chipwitch for this post:
 
(login for full post details)
  #6 (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


chipwitch View Post
I'm 99% sure you cannot do ATM trades from within a script. You can do what they call "managed" or "unmanaged" trades in a script. You can do a bracket pretty easily with managed trail stops (using the NT method) or stop limits and targets. If you want to change an order, for example, that will be an unmanaged trade and they warn only experienced coders should do these. There's actually a lot to it if you think about it... every order needs to wait for the confirm and then consider that before "closing" a position lest you actually be opening one instead. That sort of thing.

It depends...

Are you talking about a strategy or an indicator?

Also, it depends on if you are talking about the trades being placed by strategy-logic, or ATM-logic?

The two are different... E.g., the strategy-logic trades, will run trades from bar zero, to the current bar, and places those trades, and create a strategy-position.

ATM-logic trades, do not run on prior bars, and start in real-time... so when using this logic, both the unmanaged and managed methods you typically use, do not apply here. See THIS link and they kind of talk about it here.

I've got one working right now. I'm gonna post a video of it, running on replay data, and show you what I mean.

I just got into this ATM stuff a few days ago. I knew what I wanted TO DO, but I didn't know what it was. I wished someone could have told me to look into the ATM section, would have saved me the several hours spent reading the docs trying to figure it out

Reply With Quote
The following user says Thank You to forrestang for this post:
 
(login for full post details)
  #7 (permalink)
 chipwitch 
Nashville, TN
 
Experience: Beginner
Platform: NinjaTrader
Broker: NinjaTrader, Continuum Data
Trading: MES for now... baby steps
 
chipwitch's Avatar
 
Posts: 320 since Feb 2022
Thanks: 229 given, 595 received


forrestang View Post
It depends...

Are you talking about a strategy or an indicator?

Also, it depends on if you are talking about the trades being placed by strategy-logic, or ATM-logic?

The two are different... E.g., the strategy-logic trades, will run trades from bar zero, to the current bar, and places those trades, and create a strategy-position.

ATM-logic trades, do not run on prior bars, and start in real-time... so when using this logic, both the unmanaged and managed methods you typically use, do not apply here. See THIS link and they kind of talk about it here.

I've got one working right now. I'm gonna post a video of it, running on replay data, and show you what I mean.

I just got into this ATM stuff a few days ago. I knew what I wanted TO DO, but I didn't know what it was. I wished someone could have told me to look into the ATM section, would have saved me the several hours spent reading the docs trying to figure it out

Good to know, thanks! I looked all over for that and couldn't find it!

Reply With Quote
The following user says Thank You to chipwitch for this post:
 
(login for full post details)
  #8 (permalink)
 sam028 
Site Moderator
 
 
sam028's Avatar
 
Posts: 3,706 since Jun 2009
Thanks: 3,806 given, 4,556 received


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

There are multiple reasons, like having a sexier ChartTrader with a more advanced logic, or having a manual entry which is then managed by a strategy more complex than what an ATM can do.
You can do whatever you want from an indicator, but all is not necessarily supported and documented (but it works).

Success requires no deodorant! (Sun Tzu)
Follow me on Twitter Reply With Quote
 
(login for full post details)
  #9 (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


sam028 View Post
There are multiple reasons, like having a sexier ChartTrader with a more advanced logic, or having a manual entry which is then managed by a strategy more complex than what an ATM can do.
You can do whatever you want from an indicator, but all is not necessarily supported and documented (but it works).

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.

Reply With Quote
 
(login for full post details)
  #10 (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


ATM strategies working individually.


Reply With Quote
The following 3 users say Thank You to forrestang for this post:


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