Controlling Order Entry in a strategy - EasyLanguage Programming | futures io social day trading
futures io futures trading


Controlling Order Entry in a strategy
Updated: Views / Replies:381 / 9
Created: by bmtrading9 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
 

Controlling Order Entry in a strategy

  #1 (permalink)
Market Wizard
Dallas, TX, USA
 
Futures Experience: Advanced
Platform: TOS
Broker/Data: IB
Favorite Futures: ES, YM, TF, CL, GC and ETF's
 
Posts: 1,741 since Mar 2013
Thanks: 2,823 given, 1,958 received
Forum Reputation: Legendary

Controlling Order Entry in a strategy

I am learning to code in EL and trying to generate a very simple strategy based on slope change but I would like to control the order entry using a flag as given in following code but orders are not getting generated, what am I doing wrong?

I want to control when to enter the market using LongTradeFlag and ShortTradeFlag but this simple thing I couldn't get it working. It compiles successfully but in real time on sim account orders are not generated.

Thanks in advance

 
Code
[IntrabarOrderGeneration = false]

Inputs: WMALength(89), Price(Close), posSize(1), StopTicks(40), BrokerFlag(false);//, LongTradeFlag(true), ShortTradeFlag(false);

variables:
	var0( 0 ),
	myStop(0);

Vars: LongTradeFlag(false), ShortTradeFlag(true);

var0 = WAverage( Price, WMALength ) ;

//condition1 = (Price >= var0) and (var0 > var0[1] and var0[1] < var0[2]) ;
//condition2 = (Price <= var0) and (var0 < var0[1] and var0[1] > var0[2]) ;

Condition1 = var0 > var0[1] and LongTradeFlag = true;
Condition2 = var0 < var0[1] and ShortTradeFlag = true;

Condition3 = date = currentdate and time > currenttime-1;



If condition1 then Begin

		
	if price >= var0 and marketposition <> 1 then begin
		Buy ("LE") posSize contracts next bar at Market;
		ShortTradeFlag = true;
		LongTradeFlag = false;
	end;
End;

If condition2 then Begin
	
	if price <= var0  and marketposition <> -1 then begin
		Sell short ("SE") posSize contracts next bar at Market;
		ShortTradeFlag = false;
		LongTradeFlag = true;

	end;
End;

Reply With Quote
The following 2 users say Thank You to bmtrading9 for this post:
 
  #2 (permalink)
Quick Summary
Quick Summary Post

Quick Summary is created and edited by users like you... Add FAQ's, Links and other Relevant Information by clicking the edit button in the lower right hand corner of this message.

 
  #3 (permalink)
Market Wizard
Hamburg Germany
 
Futures Experience: Advanced
Platform: Multicharts, Tradestation, Multicharts.NET, NinjaTrader, MetaTrader
Broker/Data: DTN IQ
Favorite Futures: ES
 
Posts: 1,403 since Apr 2013
Thanks: 219 given, 797 received
Forum Reputation: Legendary


bmtrading9,

I'd suggest to add print statements to your code, so you know what is going on internally. For example that your Condition1 and Condition2 can never become true and your system won't be able to enter trades.
Besides that as you start out, I'd suggest to get into the habit of using meaningful variable names and to comment your code as this will make your live so much easier down the road.

Regards,

ABCTG

Reply With Quote
The following 2 users say Thank You to ABCTG for this post:
 
  #4 (permalink)
Market Wizard
Dallas, TX, USA
 
Futures Experience: Advanced
Platform: TOS
Broker/Data: IB
Favorite Futures: ES, YM, TF, CL, GC and ETF's
 
Posts: 1,741 since Mar 2013
Thanks: 2,823 given, 1,958 received
Forum Reputation: Legendary


ABCTG View Post
bmtrading9,

I'd suggest to add print statements to your code, so you know what is going on internally. For example that your Condition1 and Condition2 can never become true and your system won't be able to enter trades.
Besides that as you start out, I'd suggest to get into the habit of using meaningful variable names and to comment your code as this will make your live so much easier down the road.

Regards,

ABCTG

Thanks for your response, yes, I have to add print statements (I need to do some research on how to do it). I didn't get you point of Condition1 and Condition2 will never become true.

My thinking is when I turn on the strategy it should consider only SHORT TRADES as per the code isn't it? This is the main idea behind this exercise i.e control the entry in the strategy based on flag. If you have any better way to control the entries in a strategy please suggest.

Reply With Quote
 
  #5 (permalink)
Market Wizard
Hamburg Germany
 
Futures Experience: Advanced
Platform: Multicharts, Tradestation, Multicharts.NET, NinjaTrader, MetaTrader
Broker/Data: DTN IQ
Favorite Futures: ES
 
Posts: 1,403 since Apr 2013
Thanks: 219 given, 797 received
Forum Reputation: Legendary

Sorry, my bad I overlooked that you initialized ShortTradeFlag with true on declaration. I loaded your code here and it's taking plenty of trades, so it might just be a settings issue. I used an @ES# 5 minute chart and 10 days back.

You can find information on how to utilize the print reserved word here.

Regards,

ABCTG

Reply With Quote
The following 2 users say Thank You to ABCTG for this post:
 
  #6 (permalink)
Market Wizard
Dallas, TX, USA
 
Futures Experience: Advanced
Platform: TOS
Broker/Data: IB
Favorite Futures: ES, YM, TF, CL, GC and ETF's
 
Posts: 1,741 since Mar 2013
Thanks: 2,823 given, 1,958 received
Forum Reputation: Legendary

It doesn't take in real time, that's what puzzling me.

Sent from my SAMSUNG-SM-G900A using Tapatalk

Reply With Quote
 
  #7 (permalink)
Market Wizard
Dallas, TX, USA
 
Futures Experience: Advanced
Platform: TOS
Broker/Data: IB
Favorite Futures: ES, YM, TF, CL, GC and ETF's
 
Posts: 1,741 since Mar 2013
Thanks: 2,823 given, 1,958 received
Forum Reputation: Legendary


bmtrading9 View Post
It doesn't take in real time, that's what puzzling me.

Sent from my SAMSUNG-SM-G900A using Tapatalk

I guess the issue is these variables are getting assigned on every bar update so controlling that might help.

Reply With Quote
 
  #8 (permalink)
Market Wizard
Dallas, TX, USA
 
Futures Experience: Advanced
Platform: TOS
Broker/Data: IB
Favorite Futures: ES, YM, TF, CL, GC and ETF's
 
Posts: 1,741 since Mar 2013
Thanks: 2,823 given, 1,958 received
Forum Reputation: Legendary


ABCTG View Post
Sorry, my bad I overlooked that you initialized ShortTradeFlag with true on declaration. I loaded your code here and it's taking plenty of trades, so it might just be a settings issue. I used an @ES# 5 minute chart and 10 days back.

You can find information on how to utilize the print reserved word here.

Regards,

ABCTG

Those print statements helped in identifying what is happening so I thought...


Why can't I initialize the variables LongTradeFlag(true), ShortTradeFlag(false) from INPUT?

but I was getting following compiling error

"array, varable or refinput expected"

I guess if I can control this flag from INPUT, I should be able to solve this...

Reply With Quote
 
  #9 (permalink)
Market Wizard
Hamburg Germany
 
Futures Experience: Advanced
Platform: Multicharts, Tradestation, Multicharts.NET, NinjaTrader, MetaTrader
Broker/Data: DTN IQ
Favorite Futures: ES
 
Posts: 1,403 since Apr 2013
Thanks: 219 given, 797 received
Forum Reputation: Legendary

Because variables and inputs are two different things. You can't use an input like a variable.

You would need two variables and two different inputs and then store one input's value in one variable and the second one in the other.

Regards,

ABCTG


bmtrading9 View Post
Why can't I initialize the variables LongTradeFlag(true), ShortTradeFlag(false) from INPUT?


Reply With Quote
The following 2 users say Thank You to ABCTG for this post:
 
  #10 (permalink)
Market Wizard
Dallas, TX, USA
 
Futures Experience: Advanced
Platform: TOS
Broker/Data: IB
Favorite Futures: ES, YM, TF, CL, GC and ETF's
 
Posts: 1,741 since Mar 2013
Thanks: 2,823 given, 1,958 received
Forum Reputation: Legendary



ABCTG View Post
Because variables and inputs are two different things. You can't use an input like a variable.

You would need two variables and two different inputs and then store one input's value in one variable and the second one in the other.

Regards,

ABCTG

Thanks alot! That's perfect on the first run. I have to look deep into it.

Reply With Quote

Reply



futures io > > > > > Controlling Order Entry in a strategy

Thread Tools Search this Thread
Search this Thread:

Advanced Search



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

July Journal Challenge w/$1100 in prizes from TopstepTrader

July
 

An Afternoon with FIO member Softsoap

Elite only

Battlestations: Show us your trading desks and win $750 in prizes

August
 

Extended Ask Me Anything w/Brett Steenbarger

Elite only

Prototyping Python Strategies (part 3) w/Ran Aroussi

Elite only

Brannigan Barrett w/Axia Futures

Elite only

Introduction to Phillip Capital futures brokerage services

Aug TBD

How Monte Carlo Analysis Can Help Your Trading w/Kevin Davey

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Entry Order Causing NT Strategy to Stop Working JGSmith The Elite Circle 1 June 18th, 2014 04:24 PM
Chasing a limit order entry in an auto-strategy nanobiotech Elite Automated Trading 7 August 17th, 2011 05:39 AM
Quicker Order Entry RambleDog NinjaTrader 6 August 1st, 2011 01:59 AM
Viper has a "order entry strategy" that you can use to enter and exit. rcr3908 NinjaTrader 2 April 30th, 2011 05:20 PM
OCO Entry Order from Strategy decs0057 NinjaTrader Programming 1 March 24th, 2010 02:48 PM


All times are GMT -4. The time now is 01:03 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-07-21 in 0.11 seconds with 19 queries on phoenix via your IP 54.224.109.48