newbe programmer question - NinjaTrader Programming | futures io social day trading
futures io futures trading


newbe programmer question
Updated: Views / Replies:2,041 / 13
Created: by eurostoxx 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
 

newbe programmer question

  #1 (permalink)
Elite Member
T. Dot
 
Futures Experience: Advanced
Platform: TT
Favorite Futures: FESX
 
Posts: 18 since Oct 2009
Thanks: 1 given, 0 received

newbe programmer question

Hi
I am trying to write a Ninja Script code for a very simple strategy but it is taking me forever to figure it out and I think I need some help Basically the strategy is time dependant
1st part
When the time is between 9:30 – 10:30
If the low of the 1min candles is always above the 10 EMA, then condition 1 = True
Else if the high of the 1min candles is always below the 10 EMA, then codition 2 = Ture

2nd part
When the time is greater than 11:30
If condition 1 was true and now the low <= the 10 ema, then buy
If condition 2 was true and now the high >= the 10 ema, then sell
If have coded it in NT, but obviously I am doing something wrong,

Here is my code, any help would be greatly appreciated… I think I am off somewhere regarding my initial condions…
if (ToTime(Time[0]) > ToTime(9,30,00) && ToTime(Time[0]) < ToTime(10,30,00))
{
if (Low[60] > EMA(14)[0])
{
condition1 = true;
}
else if (High[60] < EMA(14)[0])
{
condition3 = true;
}

}

if (tradecounter < 4)

{
if (condition1 = true
&& ToTime(Time[0]) >= ToTime(11,30,00)
&& Low[0] < EMA(14)[0])
{
DrawDot("My dot" + CurrentBar, false, 0, 0, Color.Blue);
Alert("MyAlert0", Priority.High, "", "", 0, Color.White, Color.Black);
EnterLong(DefaultQuantity, "");
tradecounter++;
}

else if (condition3 = true
&& ToTime(Time[0]) >= ToTime(11,30,00)
&& High[0] > EMA(14)[0])
{
DrawDot("My dot" + CurrentBar, false, 0, 0, Color.Blue);
Alert("MyAlert0", Priority.High, "", "", 0, Color.White, Color.Black);
EnterShort(DefaultQuantity, "");
tradecounter++;
}
}

Reply With Quote
 
  #2 (permalink)
Elite Member
Austin, TX
 
Futures Experience: Advanced
Platform: NT/Matlab
Broker/Data: Interactive Brokers
Favorite Futures: FX majors
 
sefstrat's Avatar
 
Posts: 285 since Jun 2009
Thanks: 20 given, 749 received

The only thing blatant I see:

if (condition1 = true

should be

if (condition1 == true

Reply With Quote
 
  #3 (permalink)
Administrator: Retired Backtester
 Vendor: speedytradingservers.com 
Rennes France
 
Futures Experience: Advanced
Platform: NinjaTrader
Broker/Data: IB/Kinetick
Favorite Futures: Futures
 
sam028's Avatar
 
Posts: 3,366 since Jun 2009
Thanks: 3,574 given, 3,982 received



sefstrat View Post
The only thing blatant I see:

if (condition1 = true

should be

if (condition1 == true

Or
 
Code
                            
if (condition1) {... 


Reply With Quote
 
  #4 (permalink)
Elite Member
T. Dot
 
Futures Experience: Advanced
Platform: TT
Favorite Futures: FESX
 
Posts: 18 since Oct 2009
Thanks: 1 given, 0 received

will it mater if condition 1 is a bool variable.. i thought I could just write "true" ,,,I thought the problem was that I didnt not get the coding right for the

if the low of the last 60 mins was above the 14 period EMA (as in the lows of the 1min candles never touched the EMA line in the past hour) - in ninja trader is written as

if (ToTime(Time[0]) > ToTime(9,30,00) && ToTime(Time[0]) < ToTime(10,30,00))
{
if (Low[60] > EMA(14)[0])

Reply With Quote
 
  #5 (permalink)
Elite Member
T. Dot
 
Futures Experience: Advanced
Platform: TT
Favorite Futures: FESX
 
Posts: 18 since Oct 2009
Thanks: 1 given, 0 received

thanks for the reply's btw... really appreciated

Reply With Quote
 
  #6 (permalink)
Site Administrator
Manta, Ecuador
 
Futures Experience: Advanced
Platform: My own custom solution
Favorite Futures: E-mini ES S&P 500
 
Big Mike's Avatar
 
Posts: 46,240 since Jun 2009
Thanks: 29,354 given, 83,237 received

Low[60] is not the low of the last sixty minutes. Also, unless you've included something like
 
Code
                            
if (CurrentBar 60) return; 

Then using Low[60] is going to throw an error anyway for an out of bounds index. You need to be reviewing the Log tab of the control center for errors, if this strategy has compiled successfully but is not working as expected.

If you are using a 1-minute bar, low[60] is the low of the bar 60 minutes ago.

You need to use MIN(Low, 60)[0] to find out what the low is over the last 60 bars.

Also, you need to either post the exact error message you are receiving upon compiling (bottom of the screen), or you need to post the .cs file itself. I (we) can not really help otherwise because we don't know what the error is.

Mike

Due to time constraints, please do not PM me if your question can be resolved or answered on the forum.

Need help?
1) Stop changing things. No new indicators, charts, or methods. Be consistent with what is in front of you first.
2) Start a journal and post to it daily with the trades you made to show your strengths and weaknesses.
3) Set goals for yourself to reach daily. Make them about how you trade, not how much money you make.
4) Accept responsibility for your actions. Stop looking elsewhere to explain away poor performance.
5) Where to start as a trader? Watch this webinar and read this thread for hundreds of questions and answers.
6)
Help using the forum? Watch this video to learn general tips on using the site.

If you want
to support our community, become an Elite Member.

Reply With Quote
The following user says Thank You to Big Mike for this post:
 
  #7 (permalink)
Elite Member
T. Dot
 
Futures Experience: Advanced
Platform: TT
Favorite Futures: FESX
 
Posts: 18 since Oct 2009
Thanks: 1 given, 0 received

thanks for the reply mike,

I am not getting any errors in the log tab, but as you suggested I am getting errors in the execution of the strategy.

I am trying to write a script for:
If the low of all the 1-min candles > the moving average (the value of the MA corresponding to that time the low was made) then xxx = true

visually, it would look like a trending market. If the market was always trading above (or below) the moving average over a certain time period then xx = true

any ideas on how to code this

the MIN(Low, 60)[0] function would almost work except i wouldnt know what to compare it against,


Thanks again

Reply With Quote
 
  #8 (permalink)
Site Administrator
Manta, Ecuador
 
Futures Experience: Advanced
Platform: My own custom solution
Favorite Futures: E-mini ES S&P 500
 
Big Mike's Avatar
 
Posts: 46,240 since Jun 2009
Thanks: 29,354 given, 83,237 received

MIN(Low, 60)[0] will return the lowest Low value in the last 60 bars.

int _lowbar = LowestBar(Low, 60); will return the bar number the low was made on.

if (MIN(Low, 60)[0] > EMA(20)[_lowbar]) will check to see if the Low (price) is higher than the EMA(20) of [xx bars ago when the low was made].

Mike

Due to time constraints, please do not PM me if your question can be resolved or answered on the forum.

Need help?
1) Stop changing things. No new indicators, charts, or methods. Be consistent with what is in front of you first.
2) Start a journal and post to it daily with the trades you made to show your strengths and weaknesses.
3) Set goals for yourself to reach daily. Make them about how you trade, not how much money you make.
4) Accept responsibility for your actions. Stop looking elsewhere to explain away poor performance.
5) Where to start as a trader? Watch this webinar and read this thread for hundreds of questions and answers.
6)
Help using the forum? Watch this video to learn general tips on using the site.

If you want
to support our community, become an Elite Member.

Reply With Quote
 
  #9 (permalink)
Elite Member
T. Dot
 
Futures Experience: Advanced
Platform: TT
Favorite Futures: FESX
 
Posts: 18 since Oct 2009
Thanks: 1 given, 0 received

bam! thanks

PS any ideas where I can learn all the C# little stuff like the int_lowbar ... do you know if it is on the ninja site somewhere? I find stuff a little disorganized on Help function sometimes

thanks again

Reply With Quote
 
  #10 (permalink)
Site Administrator
Manta, Ecuador
 
Futures Experience: Advanced
Platform: My own custom solution
Favorite Futures: E-mini ES S&P 500
 
Big Mike's Avatar
 
Posts: 46,240 since Jun 2009
Thanks: 29,354 given, 83,237 received


int just means integer, and _lowbar is a variable name. it could be "int _iamsleepy" etc.

I suggest any C# "for dummies" book to cover basic principles, most of which apply to NinjaTrader directly, and then from there to learn NinjaScript specific commands, either read the help site cover-to-cover or just dissect all the code you can find and go line by line to understand it.

Mike

Due to time constraints, please do not PM me if your question can be resolved or answered on the forum.

Need help?
1) Stop changing things. No new indicators, charts, or methods. Be consistent with what is in front of you first.
2) Start a journal and post to it daily with the trades you made to show your strengths and weaknesses.
3) Set goals for yourself to reach daily. Make them about how you trade, not how much money you make.
4) Accept responsibility for your actions. Stop looking elsewhere to explain away poor performance.
5) Where to start as a trader? Watch this webinar and read this thread for hundreds of questions and answers.
6)
Help using the forum? Watch this video to learn general tips on using the site.

If you want
to support our community, become an Elite Member.

Reply With Quote

Reply



futures io > > > > > newbe programmer question

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
Need to hire a programmer mediaboy EasyLanguage Programming 2 June 16th, 2011 09:11 AM
looking for a programmer ceramictilepro NinjaTrader Programming 3 March 9th, 2011 06:34 AM
seeking NT7 programmer gparkis NinjaTrader Programming 2 February 13th, 2011 08:19 AM


All times are GMT -4. The time now is 12:01 PM.

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-17 in 0.14 seconds with 19 queries on phoenix via your IP 54.90.92.204