having trouble restricting to one trade per session - EasyLanguage Programming | futures io social day trading
futures io futures trading


having trouble restricting to one trade per session
Updated: Views / Replies:2,802 / 8
Created: by gonzofist 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
 

having trouble restricting to one trade per session

  #1 (permalink)
Elite Member
PORTLAND, OR
 
Futures Experience: None
Platform: NinjaTrader
Favorite Futures: Futures
 
Posts: 185 since Jul 2011
Thanks: 74 given, 166 received

having trouble restricting to one trade per session

I am having trouble restricting my program to 1 trade per session. I am using it for an overnight session so a lot of the standard "per day" reserved words don't apply unfortunately. I am very new to EZL so my code is probably a little messy...

It works in restricting it to one entry but once that entry closes it opens another and usually closes it immediately since my exit conditions are still in effect and does that until the end of my session.

Below is the snippets of code that apply directly to this problem.

 
Code
if ( ( T > EndTime and T < ( StartTime + 5 ) ) = FALSE ) and ( ry_Upper10NBand <> 0 ) and ( ry_Upper20NBand <> 0 ) and ( OneADay = 0 ) and Date > 1120305 then
	begin
	if ( ry_Upper10NBand > ry_Upper20NBand ) and ( C >= ( ry_Upper10NBand + ( EnterDistance * 0.0001 ) ) ) and ( marketposition = 0 ) then
		begin
		Buy ( "NoiseLong1" ) next bar at ( ry_Upper10NBand + ( ( EnterDistance + 1 ) * 0.0001 ) ) stop ;
		OneADay = OneADay + 1 ;
		end ;
	if ( ry_Upper20NBand > ry_Lower10NBand ) and ( C >= ( ry_Upper20NBand + ( EnterDistance * 0.0001 ) ) ) and ( marketposition = 0 ) then
		begin
		Buy ( "NoiseLong2" ) next bar at ( ry_Upper20NBand + ( ( EnterDistance + 1 ) * 0.0001 ) ) stop ;
		OneADay = OneADay + 1 ;
		end ;
	end ;
and

 
Code
if T = EndTime then OneADay = 0 ;
anything you guys can do to help is much appreciated!

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.

 
  #3 (permalink)
Elite Member
Colorado
 
Futures Experience: Advanced
Platform: MultiCharts
Broker/Data: IB & Iqfeed
Favorite Futures: ES , CL
 
sptrader's Avatar
 
Posts: 533 since Apr 2010
Thanks: 1,080 given, 668 received


When I used Tradestation several years ago, I remember they had a function called "Tradestoday" ..
So I would write : if tradestoday = 0 then begin (If I only wanted 1 trade/day)..
It's an easy way to limit the number of trades allowed per day.

Reply With Quote
The following user says Thank You to sptrader for this post:
 
  #4 (permalink)
Elite Member
PORTLAND, OR
 
Futures Experience: None
Platform: NinjaTrader
Favorite Futures: Futures
 
Posts: 185 since Jul 2011
Thanks: 74 given, 166 received

Unfortunately, since my session covers multiple days ( 11:00 PM - 9:00 AM ) the tradestoday function doesn't really work for me, I haven't been able to find something similarly simple that works for session that covers multiple days.

Reply With Quote
 
  #5 (permalink)
Trading for Fun
Boise Idaho/US
 
Futures Experience: Beginner
Platform: NinjaTrader
Favorite Futures: Guitar
 
BlackSwan04's Avatar
 
Posts: 50 since Mar 2012
Thanks: 63 given, 60 received

I played around with Ninjatrader automated strategies for awhile. The way I would tell it to stop trading is at the beginning of the session I'd set "variable x = 0". Add an "if variable x == 0" argument to your trade premise. As part of the command that sets off the trade, also set variable x = 1. This should stop any other trades from happening until the next session.
Not sure if that's possible in tradestation but it worked for me on Ninjatrader.

Pseudocode example (All additions in Blue/be sure to scroll over to the right to see them all):
 
Code
if ( ( T > EndTime and T < ( StartTime + 5 ) ) = FALSE ) and ( ry_Upper10NBand <> 0 ) and ( ry_Upper20NBand <> 0 ) and ( OneADay = 0 ) and Date > 1120305 then
	SET VARIABLE "X=0";
        begin
	if ( ry_Upper10NBand > ry_Upper20NBand ) and ( C >= ( ry_Upper10NBand + ( EnterDistance * 0.0001 ) ) and (VARIABLE "X==0") ) and ( marketposition = 0 ) then
		begin
		Buy ( "NoiseLong1" ) next bar at ( ry_Upper10NBand + ( ( EnterDistance + 1 ) * 0.0001 ) ) stop ;
		OneADay = OneADay + 1 ;
                SET VARIABLE "X=1" ;
		end ;
	if ( ry_Upper20NBand > ry_Lower10NBand ) and ( C >= ( ry_Upper20NBand + ( EnterDistance * 0.0001 ) ) and (VARIABLE "X==0") ) and ( marketposition = 0 ) then
		begin
		Buy ( "NoiseLong2" ) next bar at ( ry_Upper20NBand + ( ( EnterDistance + 1 ) * 0.0001 ) ) stop ;
		OneADay = OneADay + 1 ;
                SET VARIABLE "X=1";
		end ;
	end ;

Reply With Quote
The following user says Thank You to BlackSwan04 for this post:
 
  #6 (permalink)
Elite Member
Reno, Nevada
 
Futures Experience: Advanced
Platform: NinjaTrader
Favorite Futures: ZN, ZB, FDAX
 
phantomtrader's Avatar
 
Posts: 158 since May 2011
Thanks: 13 given, 226 received

Hi: I do something similar and use the following code setup:

Inputs: Time1(100), Time2(2400), Amount(1) .........


Then undernearth your variables put in:

If time >= time1 and time <= time2 then begin

If TradesToday(Date) < (amount) then
begin


It will require an "end", "end" somewhere and can be tricky - I write my codes as individual conditions and one "end" goes after the conditions and the other at the bottom after the execution trigger code. You might have to play with the placement of "end" if it doesn't trigger.

You would have to remove your "StartTime" code to use this or it will conflict.

This should trigger a single trade per day within a 24 hour period.

Let me know if it works.

Reply With Quote
The following user says Thank You to phantomtrader for this post:
 
  #7 (permalink)
Elite Member
PORTLAND, OR
 
Futures Experience: None
Platform: NinjaTrader
Favorite Futures: Futures
 
Posts: 185 since Jul 2011
Thanks: 74 given, 166 received

BlackSwan :Thanks for the help, this is essentially what my code is already attempting to do. The "OneADay" variable is intended to stop the "if" statement from executing. My placement within the code is slightly different than what you suggest here so I'll give it a try in the spot you have it and see how it goes.

Phantomtrader : I really like this way of doing it and will attempt to apply it to my code, I'm trying to think of a way to restrict my trades to the 11:00 PM to 9:00 AM (PST) custom session and still use your 1 trade every 24 hours code.


Last edited by gonzofist; January 17th, 2013 at 08:45 PM.
Reply With Quote
 
  #8 (permalink)
Elite Member
Reno, Nevada
 
Futures Experience: Advanced
Platform: NinjaTrader
Favorite Futures: ZN, ZB, FDAX
 
phantomtrader's Avatar
 
Posts: 158 since May 2011
Thanks: 13 given, 226 received


gonzofist View Post
BlackSwan :Thanks for the help, this is essentially what my code is already attempting to do. The "OneADay" variable is intended to stop the "if" statement from executing. My placement within the code is slightly different than what you suggest here so I'll give it a try in the spot you have it and see how it goes.

Phantomtrader : I really like this way of doing it and will attempt to apply it to my code, I'm trying to think of a way to restrict my trades to the 11:00 PM to 9:00 AM (PST) custom session and still use your 1 trade every 24 hours code.

I may have an idea about that - let me look in my code library and I'll get back to you.

Reply With Quote
The following user says Thank You to phantomtrader for this post:
 
  #9 (permalink)
Trading for Fun
Boise Idaho/US
 
Futures Experience: Beginner
Platform: NinjaTrader
Favorite Futures: Guitar
 
BlackSwan04's Avatar
 
Posts: 50 since Mar 2012
Thanks: 63 given, 60 received


gonzofist View Post
BlackSwan :Thanks for the help, this is essentially what my code is already attempting to do. The "OneADay" variable is intended to stop the "if" statement from executing. My placement within the code is slightly different than what you suggest here so I'll give it a try in the spot you have it and see how it goes.

Phantomtrader : I really like this way of doing it and will attempt to apply it to my code, I'm trying to think of a way to restrict my trades to the 11:00 PM to 9:00 AM (PST) custom session and still use your 1 trade every 24 hours code.

Hi Gonzofist,

If the OneADay feature restricts 1 trade to a 24 hour period, you may run into missing a setup in the next session, say if your trade goes off at 12:30am, and your next signal hits the next night at 12:15 it could conceivably skip it since it would still have 15 more minutes on its "clock".
Just speculating. I have no experience with trade station and the little experience I have with Ninja automated was more for backtesting than anything else.
Backstory: I was looking for a mechanical strategy that I could manually trade, so I had a pretty tight session limit (12am - 2am at the time). However, I had to have bars on the chart before the session so that the indicators would work. As I wasn't limiting my trades to 1 a day but configuring to have them not trade outside those hours, that variable did the trick.
That said, good luck in your search. The automated road is a hard one.

Regards,
BlackSwan

Reply With Quote
The following user says Thank You to BlackSwan04 for this post:

Reply



futures io > > > > > having trouble restricting to one trade per session

Thread Tools Search this Thread
Search this Thread:

Advanced Search



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

Jigsaw Trading: TBA

Elite only

FuturesTrader71: TBA

Elite only

NinjaTrader: TBA

Jan 18

RandBots: TBA

Jan 23

GFF Brokers & CME Group: Futures & Bitcoin

Elite only

Adam Grimes: TBA

Elite only

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
24hr session plots day session open artfuls NinjaTrader 2 December 19th, 2012 10:40 AM
anyone trade Euro session at 3am EST emini_Holy_Grail Currency Futures 13 August 13th, 2012 09:04 PM
DoubleMAPaint_SharkyPkg trouble desander NinjaTrader 7 February 4th, 2011 06:16 PM
The Intensity of Commercial Trade at Local & Session Extremes UrmaBlume NinjaTrader 6 August 25th, 2010 11:23 PM
Prevent strategy from executing trade at the same price level within a session suprsnipes NinjaTrader Programming 1 February 28th, 2010 11:40 PM


All times are GMT -4. The time now is 07: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-12-18 in 0.12 seconds with 19 queries on phoenix via your IP 54.163.209.109