help with automated strategy - NinjaTrader | futures io social day trading
futures io futures trading


help with automated strategy
Updated: Views / Replies:467 / 3
Created: by maggtrading Attachments:0

Welcome to futures io.

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

futures io is the largest futures trading community on the planet, with over 90,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors – all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you don’t need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

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

Reply
 
Thread Tools Search this Thread
 

help with automated strategy

  #1 (permalink)
Trading Apprentice
méxico df, méxico
 
Futures Experience: Advanced
Platform: ninjatrader, tradestation
Broker/Data: demo so far
Favorite Futures: stocks, fdax, fdxm, fesx, rb, ho, ng, cl, tf, nq, bp, ec, jy
 
Posts: 46 since Mar 2013
Thanks: 115 given, 21 received

help with automated strategy

hello everyone,


because nt is free and because it has superior order management capabilities to other platforms i have been trying to code some simple ideas as automated strategies.


however, i have run into some unsolvable issues with variables, functions, properties and nt limitations. therefore i could use some help in coding what must be a very simple strategy for people who know what they are doing.


i would greatly appreciate if i can get help in coding a simple strategy that made trades following bollinger's bands:

if price (0) >= bollinger's upper band
enter long

if price (0) <= upper band
exit all long positions

if price (0) <= lower band
enter short

if price (0) <= lower band
exit all short positions


what i am having the most issues with is being able to have nt compare price (0) to the upper / lower bands (error message says operand can't be applied). also, i haven't been able to figure out how to define the equations used for the upper / middle / lower bands (which require elementary arithmetic operations) so that nt can then use them (as doubles? as data series? other?).



thanks a lot, regards.

Reply With Quote
 
  #2 (permalink)
Trading Apprentice
Moscow
 
Futures Experience: Intermediate
Platform: NinjaTrader
Favorite Futures: 6E
 
Posts: 10 since Mar 2016
Thanks: 1 given, 16 received


maggtrading View Post
hello everyone,


because nt is free and because it has superior order management capabilities to other platforms i have been trying to code some simple ideas as automated strategies.


however, i have run into some unsolvable issues with variables, functions, properties and nt limitations. therefore i could use some help in coding what must be a very simple strategy for people who know what they are doing.


i would greatly appreciate if i can get help in coding a simple strategy that made trades following bollinger's bands:

if price (0) >= bollinger's upper band
enter long

if price (0) <= upper band
exit all long positions

if price (0) <= lower band
enter short

if price (0) <= lower band
exit all short positions


what i am having the most issues with is being able to have nt compare price (0) to the upper / lower bands (error message says operand can't be applied). also, i haven't been able to figure out how to define the equations used for the upper / middle / lower bands (which require elementary arithmetic operations) so that nt can then use them (as doubles? as data series? other?).



thanks a lot, regards.

 
Code
if (Close[0]>=Bollinger(1,14).Upper[0])
        EnterLong(1);
			
if (Close[0]<Bollinger(1,14).Upper[0])
{
	if (Position.MarketPosition==MarketPosition.Long)
		Position.Close();
}
			
if (Close[0]<=Bollinger(1,14).Lower[0])
	EnterShort(1);
			
if (Close[0]>Bollinger(1,14).Lower[0])
{
	if (Position.MarketPosition==MarketPosition.Short)
		Position.Close();
}

Reply With Quote
The following user says Thank You to NTDeveloper for this post:
 
  #3 (permalink)
Trading Apprentice
méxico df, méxico
 
Futures Experience: Advanced
Platform: ninjatrader, tradestation
Broker/Data: demo so far
Favorite Futures: stocks, fdax, fdxm, fesx, rb, ho, ng, cl, tf, nq, bp, ec, jy
 
Posts: 46 since Mar 2013
Thanks: 115 given, 21 received


@NTDeveloper



man, thanks a lot. the code you provided works perfectly and does just what was requested.




i still could use some help with the strategy i'm trying to put together. if i wanted to define two lines of my own (longline, shortline) how could i define a couple of lines that performed the following operations and what kind of properties should they have so that nt can apply the same operands (>, <, =) between these lines and the price on close?


let's say the inputs for the bollinger bands were not hard coded into the strategy but were left as input variables so that they could be optimized: longperiod, longconstant, shortperiod and shortconstant.


the lines would then be:


longline = sma (longperiod) + ( longconstant * stdv (longperiod))

shortline = sma (shortperiod ) - ( shortconstant* stdv (shortperiod ))


i haven't been able to get this kind of adjustable bollinger bands to work on nt, not by defining them as double variables, nor integers nor data sets. it must be some very basic mistake i keep making, but i hope someone with a lot more experience coding on nt can help me get past this obstacle.

Reply With Quote
 
  #4 (permalink)
Trading Apprentice
Moscow
 
Futures Experience: Intermediate
Platform: NinjaTrader
Favorite Futures: 6E
 
Posts: 10 since Mar 2016
Thanks: 1 given, 16 received

 
Code
double longline=SMA(longperiod}[0]+(longconstant*StdDev(longperiod)[0];
if (Close[0]>=longline)
	EnterLong(1);

Reply With Quote
The following user says Thank You to NTDeveloper for this post:

Reply



futures io > > > > help with automated strategy

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)

Jigsaw Trading: TBA

Elite only

FuturesTrader71: TBA

Elite only

NinjaTrader: TBA

Jan 18

RandBots: TBA

Jan 23

GFF Brokers & CME Group: Futures & Bitcoin

Elite only

Adam Grimes: TBA

Elite only

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Call ATM Strategy on an automated strategy to control position jsengxx NinjaTrader Programming 7 May 31st, 2016 05:51 PM
Entry Strategy-automated is this possible Rad4633 NinjaTrader Programming 7 October 20th, 2014 04:22 PM
Semi Automated strategy kandlekid NinjaTrader Programming 7 June 7th, 2012 06:24 PM
Strategy SEMI AUTOMATED peter88 NinjaTrader Programming 1 January 25th, 2011 01:43 PM
Automated Strategy with two profit targets rexman00799 NinjaTrader Programming 6 July 23rd, 2010 10:59 PM


All times are GMT -4. The time now is 04:41 AM.

Copyright © 2017 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, 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
Page generated 2017-12-15 in 0.10 seconds with 19 queries on phoenix via your IP 54.234.255.29