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


Controlling Order Entry in a strategy
Started: by bmtrading9 Views / Replies:233 / 9
Last Reply: Attachments:0

Welcome to futures.io.

Welcome, Guest!

This forum was established to help traders (especially futures traders) by openly sharing indicators, strategies, methods, trading journals and discussing the psychology of trading.

We are fundamentally different than most other trading forums:
  • We work extremely hard to keep things positive on our forums.
  • We do not tolerate rude behavior, trolling, or vendor advertising in posts.
  • We firmly believe in openness and encourage sharing. The holy grail is within you, it is not something tangible you can download.
  • 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, and we will never resell your private information.

-- Big Mike

Reply
 
Thread Tools Search this Thread
 

Controlling Order Entry in a strategy

  #1 (permalink)
Elite Member
Dallas, TX, USA
 
Futures Experience: Advanced
Platform: TOS
Broker/Data: IB
Favorite Futures: ES, YM, TF, CL, GC and ETF's
 
Posts: 1,607 since Mar 2013
Thanks: 2,568 given, 1,717 received

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)
 Vendor: abctradinggroup.com 
Hamburg Germany
 
Futures Experience: Advanced
Platform: Multicharts, Tradestation, Multicharts.NET, NinjaTrader, MetaTrader
Broker/Data: DTN IQ
Favorite Futures: ES
 
Posts: 1,183 since Apr 2013
Thanks: 197 given, 678 received


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)
Elite Member
Dallas, TX, USA
 
Futures Experience: Advanced
Platform: TOS
Broker/Data: IB
Favorite Futures: ES, YM, TF, CL, GC and ETF's
 
Posts: 1,607 since Mar 2013
Thanks: 2,568 given, 1,717 received


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)
 Vendor: abctradinggroup.com 
Hamburg Germany
 
Futures Experience: Advanced
Platform: Multicharts, Tradestation, Multicharts.NET, NinjaTrader, MetaTrader
Broker/Data: DTN IQ
Favorite Futures: ES
 
Posts: 1,183 since Apr 2013
Thanks: 197 given, 678 received

Futures Edge on FIO
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)
Elite Member
Dallas, TX, USA
 
Futures Experience: Advanced
Platform: TOS
Broker/Data: IB
Favorite Futures: ES, YM, TF, CL, GC and ETF's
 
Posts: 1,607 since Mar 2013
Thanks: 2,568 given, 1,717 received

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)
Elite Member
Dallas, TX, USA
 
Futures Experience: Advanced
Platform: TOS
Broker/Data: IB
Favorite Futures: ES, YM, TF, CL, GC and ETF's
 
Posts: 1,607 since Mar 2013
Thanks: 2,568 given, 1,717 received


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)
Elite Member
Dallas, TX, USA
 
Futures Experience: Advanced
Platform: TOS
Broker/Data: IB
Favorite Futures: ES, YM, TF, CL, GC and ETF's
 
Posts: 1,607 since Mar 2013
Thanks: 2,568 given, 1,717 received


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)
 Vendor: abctradinggroup.com 
Hamburg Germany
 
Futures Experience: Advanced
Platform: Multicharts, Tradestation, Multicharts.NET, NinjaTrader, MetaTrader
Broker/Data: DTN IQ
Favorite Futures: ES
 
Posts: 1,183 since Apr 2013
Thanks: 197 given, 678 received

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)
Elite Member
Dallas, TX, USA
 
Futures Experience: Advanced
Platform: TOS
Broker/Data: IB
Favorite Futures: ES, YM, TF, CL, GC and ETF's
 
Posts: 1,607 since Mar 2013
Thanks: 2,568 given, 1,717 received



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)

2016 True Edge Awards: Voting is open until Jan 21!

Now
 

Bookmap New Indicator Panel, Cumulative Delta, Order Flow demo

Jan 17
 

An Afternoon with FIO member Massive l

Elite only

Leo Murphy: Making sense of Technical Analysis and Random Walk

Elite only
 

FuturesTrader71: Ask Me Anything

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 05:24 PM
Chasing a limit order entry in an auto-strategy nanobiotech Elite Automated Trading 7 August 17th, 2011 06:39 AM
Quicker Order Entry RambleDog NinjaTrader 6 August 1st, 2011 02:59 AM
Viper has a "order entry strategy" that you can use to enter and exit. rcr3908 NinjaTrader 2 April 30th, 2011 06:20 PM
OCO Entry Order from Strategy decs0057 NinjaTrader Programming 1 March 24th, 2010 03:48 PM


All times are GMT -4. The time now is 02:05 AM.

no new posts
Page generated 2017-01-18 in 0.13 seconds with 19 queries on phoenix via your IP 174.129.187.112