First automated order handling system - EasyLanguage Programming | futures io social day trading
futures io futures trading


First automated order handling system
Updated: Views / Replies:413 / 1
Created: by TahuPhoenix 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
 

First automated order handling system

  #1 (permalink)
Trading Apprentice
Lund Sweden
 
Futures Experience: Intermediate
Platform: MultiCharts
Favorite Futures: Stocks
 
Posts: 4 since Feb 2015
Thanks: 1 given, 0 received

First automated order handling system

Dear Forums,

I'm currently trying to write my first automated order handling system. This appeared to be a little more difficult because of the limitations of testing it. Thus, I hope I could get some feedback from some of the more experienced PL/EL-programmers here on futures.io (formerly BMT).

Code is intented to be used by the Portfolio Trader. My thoughts for the code is the following:

- If a buy signal is generated: Determine order size(in cash) by checking the current cash liquidity on the account. Don't place any orders if there are Open Positions already.

- Determine order size(in shares) by taking my order size(in cash) and dividing by bid/ask.

- Place a buy order between 10 and 11. First, place a bid order and a SL to this. If the order doesn't go through and the clock passes 11, take the current asked price (market order).

- Place a sell order three days after the buy order came through between 10 and 11. First, place a ask order. If the order doesn't go through and the clock passes 11, take the current bid price (market order).

- If the spread is 7 % or higher, then don't place any market orders.


Note: Data1 is minute-to-minute and Data2 is day-to-day resolution.

The Code:
 
Code
Inputs:
	minimumorder(1000),
	maximumorder(2000),
	accountIDUsed("Test123");

Vars:
	Intrabarpersist nextOrdSize(0),
	Intrabarpersist wantToBuy(false),
        Intrabarpersist nbrOfShares(1),
	Intrabarpersist buyWait(false),
	Intrabarpersist sellWait(false);
	

condition1 = EXTERNAL_BUY_SIGNAL; //Pseudo-code
condition2 = EXTERNAL_ACCOUNT_CONDITION; //Pseudo-code
condition3 = EXTERNAL_ACCOUNT_CONDITION2; //Pseudo-code


{ Account and Order Conditions }

if GetPositionTotalCost(getsymbolname(), accountIDUsed) <= 0 and GetBDCashBalance(accountIDUsed) >= minimumorder and condition1 then
begin
	wantToBuy = true;
	if condition2 then
	begin
		nextOrdSize = minimumorder;
	end
	else if condition3 then
	begin
		nextOrdSize = maximumorder;
	end;
end;

{ ======================= }

{ BUY }

if GetPositionTotalCost(getsymbolname(), accountIDUsed) <= 0 then
begin
	if wantToBuy and Time[1] >= 1000 and Time < 1100 and buyWait = false then
	begin
		nbrOfShares = nextOrdSize/CurrentBid;
		Buy (getsymbolname() + "_BuyOrder_bid") nbrOfShares shares next bar at CurrentBid Limit;
		buyWait = true;
		
		// Calculate Stop Loss
		setstopposition;
		setstoploss(nextOrdSize * 0.08);
	end;

	if buyWait and Time >= 1100 then
	begin
		nbrOfShares = nextOrdSize/CurrentAsk;
		if ((CurrentAsk - CurrentBid)/CurrentAsk)*100 < 7 then
		begin
			Buy (getsymbolname() + "_BuyOrder_Ask") nbrOfShares shares next bar at CurrentAsk Limit;
			buyWait = false;
			
			// Calculate Stop Loss
			setstopposition;
			setstoploss(nextOrdSize * 0.08);
		end;
	end;
end;

{ ======================= }

{ SELL }

if GetPositionTotalCost(getsymbolname(), accountIDUsed) > 0 and barssinceentry data2 >= 3 then
begin
	if Time[1] >= 1000 and Time < 1100 and sellWait = false then
	begin
		nbrOfShares = nextOrdSize/CurrentBid;
		Sell (getsymbolname() + "_SellOrder_Ask") nbrOfShares shares next bar at CurrentAsk Limit;
		sellWait = true;
	end;

	if sellWait and Time >= 1100 then
	begin
		nbrOfShares = nextOrdSize/CurrentAsk;
		if ((CurrentAsk - CurrentBid)/CurrentAsk)*100 < 7 then
		begin
			Sell (getsymbolname() + "_SellOrder_Bid") nbrOfShares shares next bar at CurrentBid Limit;
			buyWait = false;
		end;
	end;
end;

{ ======================= }

This is my first automated order system and feedback is very welcome

All the best,
TahuPhoenix

Reply With Quote
 
  #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.


Reply



futures io > > > > > First automated order handling system

Thread Tools Search this Thread
Search this Thread:

Advanced Search



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

Linda Bradford Raschke: Reading The Tape

Elite only

Adam Grimes: TBA

Elite only

NinjaTrader: TBA

January

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Exchange queue order handling with futures symphys Traders Hideout 3 July 25th, 2014 07:46 AM
Order Handling to reduce Slippage sburtt NinjaTrader Programming 2 October 7th, 2013 08:11 AM
My first automated trading system sthlmjohan Elite Automated Trading 4 November 7th, 2012 06:41 PM
Server side order handling nanobiotech Traders Hideout 17 December 11th, 2010 06:12 AM
EOT Automated System pedroxp Trading Reviews and Vendors 59 December 10th, 2009 03:37 AM


All times are GMT -4. The time now is 02:53 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-12 in 0.07 seconds with 19 queries on phoenix via your IP 54.90.207.75