How to avoid more than one entry position per week - TradeStation | futures.io
futures io futures trading


How to avoid more than one entry position per week
Started: by auato Views / Replies:263 / 8
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
 

How to avoid more than one entry position per week

  #1 (permalink)
Trading Apprentice
Bradenton
 
Futures Experience: None
Platform: MultiCharts
Favorite Futures: FTSE MIB
 
Posts: 22 since May 2016
Thanks: 6 given, 4 received

How to avoid more than one entry position per week

Hi all,

Please could you recommend me a solution to avoid more than one entry in the same week? I explain better...
I am trying to build a TS. This TS is a statistical trading system with two levels per week to enter and exit into/from the position. For example, if it enters at the beginning of the week but after a while it exits due to a stop loss triggering I don't desire it enters a second time in the same week (it can may be in the next week but not in the same). I already tried by the difference between ELDateToDateTime(0) - PosTradeExitDateTime(1,0)) <= 4.35 but it doesn't work and anyway I am searching for a better (smarter and simplier solution).

Can you help me please?

Thaank you very much

auato

Reply With Quote
 
  #2 (permalink)
Elite Member
Hamburg Germany
 
Futures Experience: Advanced
Platform: Multicharts, Tradestation, Multicharts.NET, NinjaTrader, MetaTrader
Broker/Data: DTN IQ
Favorite Futures: ES
 
Posts: 1,260 since Apr 2013
Thanks: 201 given, 711 received

Hi auato,

you could for example modify the EntriesToday function to work on weeks or set a flag when you enter a trade. This flag could then be checked as part of your entry condition, if the flag is true then no more entries. Now you only have to reset the flag back to false at the end of the week.

The latter idea is probably simpler than modifying the EntriesToday function.

Regards,

ABCTG

Reply With Quote
The following user says Thank You to ABCTG for this post:
 
  #3 (permalink)
Trading Apprentice
Bradenton
 
Futures Experience: None
Platform: MultiCharts
Favorite Futures: FTSE MIB
 
Posts: 22 since May 2016
Thanks: 6 given, 4 received



ABCTG View Post
Hi auato,

you could for example modify the EntriesToday function to work on weeks or set a flag when you enter a trade. This flag could then be checked as part of your entry condition, if the flag is true then no more entries. Now you only have to reset the flag back to false at the end of the week.

The latter idea is probably simpler than modifying the EntriesToday function.

Regards,

ABCTG

Thank you ABCTG,

for example in this entry condition:
 
Code
IF INSDBAR=0 AND Direction=2 AND close this bar <= FinalMin AND dayofweek(date) <> 5 AND flag=0 then buy ("LIN") 1 contracts next bar at open
How can add also the setting of a flag just it entered? Could you kindly help me to make this line completing the setting after the buy with "flag=1"?

Then, if I got you, at a subsequent line I could write:

 
Code
IF dayofweek(date) = 1, flag=0
in which flag is reset at 0 only on monday and it means that it is ready to enter. flag=1 means it is already entered a trade (but this part is missing because I don't know how to set flag=1 when it enters)

BR,
auato

Reply With Quote
 
  #4 (permalink)
Elite Member
Hamburg Germany
 
Futures Experience: Advanced
Platform: Multicharts, Tradestation, Multicharts.NET, NinjaTrader, MetaTrader
Broker/Data: DTN IQ
Favorite Futures: ES
 
Posts: 1,260 since Apr 2013
Thanks: 201 given, 711 received

auato,

you are welcome.

You can for example set the flag to +1 when your entry conditions are true, although this wouldn't guarantee that you got a fill. So you probably want to either check for a change in the market position or if you are pyramiding check if the number of shares/contracts (using the CurrentContracts reserved word for example) is bigger than on the previous code computation.

Regards,

ABCTG

Reply With Quote
 
  #5 (permalink)
Trading Apprentice
Bradenton
 
Futures Experience: None
Platform: MultiCharts
Favorite Futures: FTSE MIB
 
Posts: 22 since May 2016
Thanks: 6 given, 4 received

Futures Edge on FIO

What value do you place on the webinars on FIO?

 

ABCTG View Post
auato,

you are welcome.

You can for example set the flag to +1 when your entry conditions are true, although this wouldn't guarantee that you got a fill. So you probably want to either check for a change in the market position or if you are pyramiding check if the number of shares/contracts (using the CurrentContracts reserved word for example) is bigger than on the previous code computation.

Regards,

ABCTG

Thanks, I am trying without success

flag=0 allows to enter
flag=1 does not allow to enter

every monday I reset flag to 0 to enter.

In the middle of week if I exit for a stoploss, everytime the next bar checks currentcontracts, it realizes that currentcontract is 0 and accordingly the falg will be reset and the next bar is ready to enter.


In an IF condition after then I have the order execution command (buy). In addition to the execution statment can I also insert after then the setting of the flag to 1? In this way I avoid the check every time with currentcontracts.

A sort of "IF condition 1 AND condition 2 then buy next bar at market AND flag=1"


Last edited by auato; August 1st, 2016 at 11:15 AM.
Reply With Quote
 
  #6 (permalink)
Elite Member
Hamburg Germany
 
Futures Experience: Advanced
Platform: Multicharts, Tradestation, Multicharts.NET, NinjaTrader, MetaTrader
Broker/Data: DTN IQ
Favorite Futures: ES
 
Posts: 1,260 since Apr 2013
Thanks: 201 given, 711 received

auato,

it's hard to guess for me where the problem could be without knowing the code. You don't have to reveal anything you consider proprietary (you could for example exchange those parts with standard open source codes, as long as the new code is still able to demonstrate the issues), but the more information you provide the easier and more likely it will be for someone to help you.

The "if ... then..." statement in your pseudo code won't work, as the "then" only includes the next code statement. You can however use the "if... then begin.... end ;" statement that will include everything within the "begin... end" in your conditional check.

Regards,

ABCTG

Reply With Quote
 
  #7 (permalink)
Trading Apprentice
Bradenton
 
Futures Experience: None
Platform: MultiCharts
Favorite Futures: FTSE MIB
 
Posts: 22 since May 2016
Thanks: 6 given, 4 received


ABCTG View Post
auato,

it's hard to guess for me where the problem could be without knowing the code. You don't have to reveal anything you consider proprietary (you could for example exchange those parts with standard open source codes, as long as the new code is still able to demonstrate the issues), but the more information you provide the easier and more likely it will be for someone to help you.

The "if ... then..." statement in your pseudo code won't work, as the "then" only includes the next code statement. You can however use the "if... then begin.... end ;" statement that will include everything within the "begin... end" in your conditional check.

Regards,

ABCTG

Hi ABCTG, thank you again.

I report below the code. Omitted only the definition of variables (all set 0 at the beginning of the code) and the calculation of Min and Max which represent the levels to enter and exit for the week. If in the week the TS enters but then it is not able to exit because doesn't touch the other level, a forced exit will be applied on Friday. To limit the bad trades I introduced STPLVL to reduce the losses @2%. STPLVL works well but as the two levels Min and Max are the same for the entire week after an exit our to STPLVL, it unfortunately enters again because there are the seme conditions to enter again. On the other hand, I would like to stop all operations if in that week SPTLVL forces the exit. I work with a time frame 5 minutes.
Maybe as you write, the statement if...then... begin ...end is the correct solution for me because I can set a flag to avoid other entries and to reset that flag the monday morning.


 
Code
IF closeW(1)<openW(1) Then Direction=1 Else Direction=2; //it sets Direction=1 to be short and 2 to be long (Direction=0 is defaulf to be flat)
 

//start the ordering to enter position
 
IF Direction=2 AND close this bar <= Min AND dayofweek(date) <> 5  then buy 1 contracts next bar at open 
       else if Direction=1 AND close this bar >= Max AND dayofweek(date) <> 5  then sellshort 1 contracts next bar at open; 
      
      
//start the ordering to exit position
 
IF marketposition=1 or marketposition=-1 then STPLVL=(Close this bar/entryprice-1); 
 
IF marketposition=1 AND close this bar >=Max OR STPLVL<= -0.02 then
              Sell next bar from Entry at open
              Else
IF marketposition=-1 AND close this bar <=Min OR STPLVL>= 0.02 then
             Buytocover next bar from Entry at open;
 
             
 
//apply the weekly stops

 
IF dayofweek(date) = 5 and time > 1700 AND marketposition=1 then Sell next bar at market
Else
IF dayofweek(date) = 5 and time > 1700 AND marketposition=-1 then buytocover next bar at market;

Reply With Quote
 
  #8 (permalink)
Elite Member
Hamburg Germany
 
Futures Experience: Advanced
Platform: Multicharts, Tradestation, Multicharts.NET, NinjaTrader, MetaTrader
Broker/Data: DTN IQ
Favorite Futures: ES
 
Posts: 1,260 since Apr 2013
Thanks: 201 given, 711 received

Hi auato,

I am a bit puzzled, you wrote:

Quoting 
Thanks, I am trying without success

flag=0 allows to enter
flag=1 does not allow to enter

every monday I reset flag to 0 to enter.

In the middle of week if I exit for a stoploss, everytime the next bar checks currentcontracts, it realizes that currentcontract is 0 and accordingly the falg will be reset and the next bar is ready to enter.

This part doesn't seem to exist in the code you posted (at least I don't see it):

 
Code
IF closeW(1)<openW(1) Then Direction=1 Else Direction=2; //it sets Direction=1 to be short and 2 to be long (Direction=0 is defaulf to be flat)
 

//start the ordering to enter position
 
IF Direction=2 AND close this bar <= Min AND dayofweek(date) <> 5  then buy 1 contracts next bar at open 
       else if Direction=1 AND close this bar >= Max AND dayofweek(date) <> 5  then sellshort 1 contracts next bar at open; 
      
      
//start the ordering to exit position
 
IF marketposition=1 or marketposition=-1 then STPLVL=(Close this bar/entryprice-1); 
 
IF marketposition=1 AND close this bar >=Max OR STPLVL<= -0.02 then
              Sell next bar from Entry at open
              Else
IF marketposition=-1 AND close this bar <=Min OR STPLVL>= 0.02 then
             Buytocover next bar from Entry at open;
 
             
 
//apply the weekly stops

 
IF dayofweek(date) = 5 and time > 1700 AND marketposition=1 then Sell next bar at market
Else
IF dayofweek(date) = 5 and time > 1700 AND marketposition=-1 then buytocover next bar at market;
I will gladly steer you in the right direction and help you, but I can't tell you where it goes wrong from the above code.

Regards,

ABCTG

Reply With Quote
The following user says Thank You to ABCTG for this post:
 
  #9 (permalink)
Trading Apprentice
Bradenton
 
Futures Experience: None
Platform: MultiCharts
Favorite Futures: FTSE MIB
 
Posts: 22 since May 2016
Thanks: 6 given, 4 received

that is the original code, I tried in a second moment to insert a flag and to discuss about this solution as you recommended me but unsuccessfully. So I came back to the original code with no flag

Reply With Quote

Reply



futures io > > > > How to avoid more than one entry position per week

Thread Tools Search this Thread
Search this Thread:

Advanced Search



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

Spring Grains Outlook w/Sean Lusk @ Walsh Trading

Elite only

FIO Video Journal Challenge featuring NinjaTrader ($2,000+ of prizes)

April

Process above all else w/Anthony Crudele @ Futures Radio Show

Elite only

Machine Learning - Quantitative Trading w/Martin Froehler @ Quantiacs

Elite only

Market Dynamics w/Peter Davies @ Jigsaw Trading

Elite only

Ask Me Anything w/Patrick Rooney @ Trading Technologies

Apr 18

Ask Me Anything w/FuturesTrader71

Apr 19

Machine Learning w/Kris Longmore

Elite only

Market Analysis w/Dave Forss

Apr 25

Introducing iSystems with Stage 5 Trading

Apr 27
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Highest Price after Position Entry stealthtrading NinjaTrader Programming 4 June 5th, 2016 01:31 PM
Avoid Loss - Best Entry Points GFIs1 The Elite Circle 10 November 29th, 2013 03:10 AM
Contract Rollover: Adopt Real World Position and manage per previous position entry RM99 EasyLanguage Programming 3 May 30th, 2012 06:55 AM
Can the Market Avoid a Sixth Straight Down Week? Quick Summary News and Current Events 0 June 9th, 2011 08:40 PM
Avoid being whipsawed on the entry candle. koganam NinjaTrader Programming 1 January 5th, 2010 03:57 AM


All times are GMT -4. The time now is 10:36 PM.

no new posts
Page generated 2017-03-27 in 0.13 seconds with 19 queries on phoenix via your IP 54.204.249.55