NexusFi: Find Your Edge


Home Menu

 





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 2,141 views
    2. thumb_up 2 thanks given
    3. group 2 followers
    1. forum 5 posts
    2. attach_file 0 attachments




 
Search this Thread

EL question--need help intraday programming

  #1 (permalink)
jschultzjr
new york, ny
 
Posts: 2 since Sep 2013
Thanks Given: 1
Thanks Received: 0

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

Can you help answer these questions
from other members on NexusFi?
Exit Strategy
NinjaTrader
Increase in trading performance by 75%
The Elite Circle
Trade idea based off three indicators.
Traders Hideout
How to apply profiles
Traders Hideout
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Just another trading journal: PA, Wyckoff & Trends
33 thanks
Tao te Trade: way of the WLD
24 thanks
My NQ Trading Journal
14 thanks
HumbleTraders next chapter
11 thanks
GFIs1 1 DAX trade per day journal
11 thanks
  #3 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,433 since Apr 2013
Thanks Given: 481
Thanks Received: 1,627


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
Thanked by:
  #4 (permalink)
jschultzjr
new york, ny
 
Posts: 2 since Sep 2013
Thanks Given: 1
Thanks Received: 0

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
  #5 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,433 since Apr 2013
Thanks Given: 481
Thanks Received: 1,627

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
  #6 (permalink)
 
sptrader's Avatar
 sptrader 
Colorado
 
Experience: Advanced
Platform: MultiCharts
Broker: IB & Iqfeed
Trading: ES , CL
Posts: 535 since Apr 2010
Thanks Given: 1,097
Thanks Received: 701


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




Last Updated on September 26, 2013


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
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.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts