NinjaTrader ATM in EasyLanguage - EasyLanguage Programming | futures io social day trading
futures io futures trading


NinjaTrader ATM in EasyLanguage
Updated: Views / Replies:4,048 / 32
Created: by Arich 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
 

NinjaTrader ATM in EasyLanguage

  #11 (permalink)
Elite Member
Springfield, Missouri
 
Futures Experience: Intermediate
Platform: NinjaTrader
Broker/Data: Interactive Brokers
Favorite Futures: EUR/USD
 
Posts: 28 since Sep 2012
Thanks: 29 given, 5 received


Bimi View Post
did you restrict the fill to one order per direction?

If I did, how would I change it back...?

Reply With Quote
 
  #12 (permalink)
Trading for Fun
London
 
Futures Experience: None
Platform: mc, TS, ninja
Favorite Futures: es
 
Bimi's Avatar
 
Posts: 118 since Mar 2010
Thanks: 42 given, 58 received


Arich View Post
If I did, how would I change it back...?

Format Signal > Property

Reply With Quote
The following user says Thank You to Bimi for this post:
 
  #13 (permalink)
Elite Member
Springfield, Missouri
 
Futures Experience: Intermediate
Platform: NinjaTrader
Broker/Data: Interactive Brokers
Favorite Futures: EUR/USD
 
Posts: 28 since Sep 2012
Thanks: 29 given, 5 received



Bimi View Post
Format Signal > Property

It works now! All three lots execute! But the positions never close.... All suggestions welcome!

Reply With Quote
 
  #14 (permalink)
Elite Member
near Paris, France
 
Futures Experience: Beginner
Platform: -
Favorite Futures: -
 
Nicolas11's Avatar
 
Posts: 1,070 since Aug 2011
Thanks: 2,232 given, 1,729 received

Hi,

Your above code is still not a SSCCE: it does not compile. I have reconstructed something by adding the first lines (inputs, variables, indicators calculation) of your initial code.

It is normal that your first trade never close, since the exit conditions are within a "if CurrentContract = 1", whereas, when in position, CurrentContract is equal to 300000.

Nicolas

Reply With Quote
 
  #15 (permalink)
Elite Member
Springfield, Missouri
 
Futures Experience: Intermediate
Platform: NinjaTrader
Broker/Data: Interactive Brokers
Favorite Futures: EUR/USD
 
Posts: 28 since Sep 2012
Thanks: 29 given, 5 received


Nicolas11 View Post
Hi,

Your above code is still not a SSCCE: it does not compile. I have reconstructed something by adding the first lines (inputs, variables, indicators calculation) of your initial code.

It is normal that your first trade never close, since the exit conditions are within a "if CurrentContract = 1", whereas, when in position, CurrentContract is equal to 300000.

Nicolas

Darn it! I apologize. :-/

Oh! That makes sense. Thanks!

Reply With Quote
 
  #16 (permalink)
Elite Member
Springfield, Missouri
 
Futures Experience: Intermediate
Platform: NinjaTrader
Broker/Data: Interactive Brokers
Favorite Futures: EUR/USD
 
Posts: 28 since Sep 2012
Thanks: 29 given, 5 received


Nicolas11 View Post
Hi,

Your above code is still not a SSCCE: it does not compile. I have reconstructed something by adding the first lines (inputs, variables, indicators calculation) of your initial code.

It is normal that your first trade never close, since the exit conditions are within a "if CurrentContract = 1", whereas, when in position, CurrentContract is equal to 300000.

Nicolas

Hi,

So I tried your suggestion and changed the "if CurrentContract = 1" to "if CurrentContract =100000" but it still doesn't work. Here is my code (it should compile just fine now):


inputs:
SlowLength (26),
FastLength (12),
MACDLength (3),
Target1 (10),
StopSize (15);

vars:
ticksize (MinMove/PriceScale),
MyMACD (0),
MACDAvg (0),
MACDDiff (0),
t1 (Target1 * ticksize),
st1 (0);

MyMACD = MACD(Close, FastLength, SlowLength);
MACDAvg = XAverage(MyMACD, MACDLength);
MACDDiff = MyMACD - MACDAvg;

// Open new Positions

if MarketPosition = 0 then begin

if MyMACD > MACDAvg and MyMACD <= 0 and MACDAvg <= 0 then begin
Buy ("Enter Long1") 100000 contract next bar at market;
end;
end;

// Manage open orders

if MarketPosition = 100000 then begin

st1 = EntryPrice - (StopSize * TickSize);

if CurrentContracts = 100000 then begin
Sell ("Exit l1-c1 Target") 100000 contracts Next Bar at (EntryPrice + t1) Limit;
Sell ("Exit l1-c1 Stop") 100000 contracts Next Bar at st1 Stop;
end;
end;

I am so confused! The exit should be with the targets, right? Suggestions are very welcome... :-/

Reply With Quote
 
  #17 (permalink)
Trading for Fun
London
 
Futures Experience: None
Platform: mc, TS, ninja
Favorite Futures: es
 
Bimi's Avatar
 
Posts: 118 since Mar 2010
Thanks: 42 given, 58 received

I am confused too; who can read your code ??? You have to learn how to use the code tag.

Reply With Quote
 
  #18 (permalink)
Elite Member
Springfield, Missouri
 
Futures Experience: Intermediate
Platform: NinjaTrader
Broker/Data: Interactive Brokers
Favorite Futures: EUR/USD
 
Posts: 28 since Sep 2012
Thanks: 29 given, 5 received


Bimi View Post
I am confused too; who can read your code ??? You have to learn how to use the code tag.

I don't know what you're talking about...? This is in the EasyLanguage Programming section of this forum, so those who can read the code are those who have platforms that use EL... What is this "code tag" that you're referring to?

Reply With Quote
 
  #19 (permalink)
Elite Member
Atlanta, Georgia
 
Futures Experience: Intermediate
Platform: NT
Broker/Data: DDT
Favorite Futures: ZN, ZB
 
cbritton's Avatar
 
Posts: 224 since Mar 2010
Thanks: 152 given, 237 received


Arich View Post
if MarketPosition = 100000 then begin


I am so confused! The exit should be with the targets, right? Suggestions are very welcome... :-/

MarketPosition can be 0 (flat), 1 (long) or -1 (short). Not sure why you have 100000 here.

-Regards,
C

“Strategy without tactics is the slowest route to victory. Tactics without strategy is the noise before defeat.” - Sun Tzu
Reply With Quote
The following user says Thank You to cbritton for this post:
 
  #20 (permalink)
Elite Member
Springfield, Missouri
 
Futures Experience: Intermediate
Platform: NinjaTrader
Broker/Data: Interactive Brokers
Favorite Futures: EUR/USD
 
Posts: 28 since Sep 2012
Thanks: 29 given, 5 received

Errors


Ok,

I've been working on getting this strategy coded in my spare time. This last weekend I was finally able to code it so that my "buys" were entered/exited, but I couldn't get my "sells" to enter or exit. I figured out why the sells were failing to execute, but now I'm getting the syntax error
Quoting 
unexpected 'end of file', expecting 'End'

I've searched high and low on the internet for solutions (or even descriptions of why it's doing this), but I have had no luck. It seems like an easy issue to fix. Can someone help, please? Here is my code:

 
Code
inputs: 
	SlowLength (26),
	FastLength (12),
	MACDLength (3),
	Target1 (10),
	Target2 (0),
	Target3 (0),
	StopSize (15),
	BE2 (0), // 0=false 1=true
	BE3 (0); // 0=false 1=true
	
vars:
	ticksize (MinMove/PriceScale),
	MyMACD (0),
	MACDAvg (0),
	MACDDiff (0),
	t1 (Target1 * ticksize),
	t2 (Target1 + Target2 *ticksize),
	t3 (Target1 + Target2 + Target3 * ticksize),
	st1 (0),
	st2 (0),
	st3 (0);

MyMACD = MACD(Close, FastLength, SlowLength);
MACDAvg = XAverage(MyMACD, MACDLength);
MACDDiff = MyMACD - MACDAvg;

// Open new Positions

if MarketPosition = 0 then begin

	if MyMACD crosses above MACDAvg and MyMACD <= 0 and MACDAvg <= 0 then begin
		Buy ("Enter Long1") 1 contract next bar at market;
		
	if MyMACD crosses below MACDAvg and MyMACD >= 0 and MACDAvg >= 0 then begin
		Sell ("Enter Short1") 1 contract next bar at market;
	end;		
end; 

// Manage open orders

if MarketPosition = 1 then begin

	st1 = EntryPrice - (StopSize * ticksize);
	
	if CurrentContracts = 1 then begin
		Sell ("Exit l1-c1 Target") 1 contracts Next Bar at (EntryPrice + t1) Limit;
		Sell ("Exit l1-c1 Stop") 1 contracts Next Bar at st1 Stop;
	end;
	
end;

if MarketPosition = -1 then begin

	st1 = EntryPrice - (StopSize * ticksize);
	
	if CurrentContracts = 1 then begin
		buytocover ("Exit s1-c1 Target") 1 contract Next Bar at (EntryPrice - t1) Limit;
		buytocover ("Exit s1-c1 Stop") 1 contract next bar at st1 Stop;
	end;
end;
Any suggestions will be very appreciated! I've been staring at this code for a couple of hours now...

Reply With Quote

Reply



futures io > > > > > NinjaTrader ATM in EasyLanguage

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
ATM Template? dsraider NinjaTrader Programming 12 May 23rd, 2012 05:52 PM
Stable ATM Strategies? Baseheadz NinjaTrader Programming 1 August 21st, 2011 04:30 PM
ATM Strategy for Ninjatrader keepdchange NinjaTrader 6 October 6th, 2010 04:57 AM
ATM and Limit Orders spinnybobo NinjaTrader Programming 6 June 12th, 2010 09:06 PM
ATM Strategies - NinjaTrader zeller4 NinjaTrader 1 June 19th, 2009 06:10 PM


All times are GMT -4. The time now is 05:03 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-14 in 0.13 seconds with 19 queries on phoenix via your IP 54.221.73.186