EL question--need help intraday programming - futures io
futures io futures trading



EL question--need help intraday programming


Discussion in EasyLanguage Programming

Updated
      Top Posters
    1. looks_one ABCTG with 2 posts (2 thanks)
    2. looks_two jschultzjr with 2 posts (0 thanks)
    3. looks_3 Quick Summary with 1 posts (0 thanks)
    4. looks_4 sptrader with 1 posts (0 thanks)
    1. trending_up 1,552 views
    2. thumb_up 2 thanks given
    3. group 2 followers
    1. forum 5 posts
    2. attach_file 0 attachments




Welcome to futures io: the largest futures trading community on the planet, with well over 125,000 members
  • Genuine reviews from real traders, not fake reviews from stealth vendors
  • Quality education from leading professional traders
  • We are a friendly, helpful, and positive community
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts
  • We are here to help, just let us know what you need
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

(If you already have an account, login at the top of the page)

 
Search this Thread
 

EL question--need help intraday programming

(login for full post details)
  #1 (permalink)
new york, ny
 
 
Posts: 2 since Sep 2013
Thanks: 1 given, 0 received

Is there a way to make an intraday strategy execute just one time? In other words, say you have a strategy.... it executes, then later it closes the position.....I want to make sure it doesn't execute again...one execution per day then strategy shuts down. Any thoughts?

Reply With Quote

Journal Challenge February 2021 results:
Competing for $1500 in prizes from Topstep
looks_oneSBtrader82 's Trading Journalby SBtrader82
(173 thanks from 31 posts)
looks_twoJust BEING a Trader: Letting Go!!by iqgod
(120 thanks from 33 posts)
looks_3Wisdom is Emptinessby Mtype
(68 thanks from 25 posts)
looks_4Deetee’s DAX Trading Journal (time based)by Deetee
(35 thanks from 17 posts)
looks_5Journal for peanuts1956by peanuts1956
(23 thanks from 13 posts)
 
 
(login for full post details)
  #3 (permalink)
 
 
Posts: 2,230 since Apr 2013
Thanks: 409 given, 1,471 received


You could monitor the number of trades and block additional trades for the day when a new trade happens.

You could also use a true/false variable that you use as a flag. When you enter a trade you set this variable to false and reset it on a date change.

 
Code
if Date <> Date[1] then
TradingAllowed = true;


if TradingAllowed and your other entry conditions are matched then
begin
 Take a trade
TradingAllowed = false;
end;
You might need to change the position where you set the flag to false, to something like
 
Code
if MarketPosition <> 0 then TradingAllowed = false;
Something like the above should get you started.

Regards,
ABCTG

Follow me on Twitter Reply With Quote
The following 2 users say Thank You to ABCTG for this post:
 
(login for full post details)
  #4 (permalink)
new york, ny
 
 
Posts: 2 since Sep 2013
Thanks: 1 given, 0 received

ABCTG,

Thanks for help and reply.

The problem I am running into still is that the strategy is missing trades that it should be taking. The problem may be that I am using hourly charts....? Is there any other way to know when a new day has arrived so I can reset the flag?

Using stock tradestation new low function:


 
Code
[IntrabarOrderGeneration = false]

inputs: int PeriodType( 1 ) ;
{ pass in 1 for chart, 2 for day, 3 for week, 4 for month, 5 for year }

variables: 
	int BT( BarType ),
	int tradecount ( 0 ),
	bool TradingallowedL ( true ),
	bool LastBarOfPeriod( false ), 
	double LowestLo( -1000000 ), { LowestLo is initialized to a large -ve value to 
	 ensure that if a calendar period is specified, the first such period on the 
	 chart is ignored because it may be incomplete }
	bool IsDailyBarOrShorter( false ),
	bool IsWeeklyBarOrShorter( false ),
	bool IsMonthBarOrShorter( false ),
	bool NextBarIsNewDay( false ),
	bool NextBarIsNewWeek( false ),
	bool NextBarIsNewMonth( false ),
	bool NextBarIsNewYear( false ) ;
		
If date<>date[1] then tradingallowedl=true;


if CurrentBar = 1 then
	begin
	IsDailyBarOrShorter = BT <= 2 or BT = 14 ;
	IsWeeklyBarOrShorter = BT <= 3 or BT = 14 ;
	IsMonthBarOrShorter = BT <= 4 or BT = 14 ;
	end ;

NextBarIsNewDay = Date <> Date next bar ;
NextBarIsNewWeek =  DayOfWeek( Date) > DayOfWeek( Date next bar ) ;
NextBarIsNewMonth = Month( Date ) <> Month( Date next bar ) ;
NextBarIsNewYear = Year( Date ) <> Year( Date next bar ) ;

if ( PeriodType = 2 and IsDailyBarOrShorter and NextBarIsNewDay )
	or ( PeriodType = 3 and IsWeeklyBarOrShorter and NextBarIsNewWeek )
	or ( PeriodType = 4 and IsMonthBarOrShorter and NextBarIsNewMonth )
	or ( PeriodType = 5 and IsMonthBarOrShorter and NextBarIsNewYear )
then
	LastBarOfPeriod = true 
else
	LastBarOfPeriod = false ;

if ( CurrentBar = 1 and ( PeriodType <= 1 or PeriodType > 5 ) ) 
	or LastBarOfPeriod[1] 
	or Low < LowestLo 
then
	LowestLo = Low ;
	
	
	
  if LastBarOfPeriod = false and tradingallowedl=true then
  begin
	Sell Short( "NewLo" ) next at bar at LowestLo - 1 point stop ;
	tradingallowedl=false;
    end;


The Red parts above it what I added to the stock new lo from tradestation....just using a simple % pair to exit...

Reply With Quote
 
(login for full post details)
  #5 (permalink)
 
 
Posts: 2,230 since Apr 2013
Thanks: 409 given, 1,471 received

jschultzjr,

you are welcome. Can you show some examples of missed trades and explain why you would expect a trade at these points?

Regards,
ABCTG

Follow me on Twitter Reply With Quote
 
(login for full post details)
  #6 (permalink)
Colorado
 
Experience: Advanced
Platform: MultiCharts
Broker: IB & Iqfeed
Trading: ES , CL
 
sptrader's Avatar
 
Posts: 543 since Apr 2010
Thanks: 1,094 given, 696 received


jschultzjr View Post
Is there a way to make an intraday strategy execute just one time? In other words, say you have a strategy.... it executes, then later it closes the position.....I want to make sure it doesn't execute again...one execution per day then strategy shuts down. Any thoughts?

***************************************************************
Tradestation has a Function called "Tradestoday", so all you have to do is add the following:
if Tradestoday(date) = 0 then begin

Reply With Quote


futures io Trading Community Platforms and Indicators EasyLanguage Programming > EL question--need help intraday programming


Last Updated on September 26, 2013


Upcoming Webinars and Events
 

NinjaTrader Indicator Challenge!

Ongoing
 

Battlestations! Show us your trading desk - $1,500 in prizes!

March
 

Call Option Buying: The New Pain Trade? w/Carley Garner

Elite only
 

Importance of Finding Your Own Way w/Adam Grimes

Elite only
 

New Challenge (TBD)

April
     



Copyright © 2021 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