NexusFi: Find Your Edge


Home Menu

 





How to enter long buy on a bar immediately before it closes.


Discussion in EasyLanguage Programming

Updated
      Top Posters
    1. looks_one kevinkdog with 7 posts (7 thanks)
    2. looks_two bmtfken with 6 posts (0 thanks)
    3. looks_3 Hulk with 4 posts (3 thanks)
    4. looks_4 ABCTG with 2 posts (2 thanks)
    1. trending_up 10,111 views
    2. thumb_up 12 thanks given
    3. group 4 followers
    1. forum 19 posts
    2. attach_file 1 attachments




 
Search this Thread

How to enter long buy on a bar immediately before it closes.

  #1 (permalink)
bmtfken
boca ration,fl/usa
 
Posts: 6 since Jul 2014
Thanks Given: 6
Thanks Received: 0

Hi all, requesting help in EasyLanguage:

I've looked all over google and the
forums and no one can answer this.
And turning on intrabarordergeneration
does NOT help, it only buys at the end
of the current bar (missing the move)

See attached pic,
I want to buy a CURRENT bar as soon as
it crosses the previous bars range high,
immediately.
EDIT: That is to say that on a Daily chart, when the current bar crosses the last daily bar high, that I need a long entry immediately.

NOT at the close of the current bar.
NOT at the open of the next bar.

Easylanguage code seems so powerful that
it is hard to believe that E.L. can't do this.

If "(a current value)" > range[1] then
buy this bar at market; does NOT work.

Is that possible using separate conditions1 ,2 etc. using a Daily bar as the trigger and then a 1 tick bar for a long entry?
??

Ken

Attached Thumbnails
Click image for larger version

Name:	strat.JPG
Views:	295
Size:	54.5 KB
ID:	150827  
Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Trade idea based off three indicators.
Traders Hideout
Increase in trading performance by 75%
The Elite Circle
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
ZombieSqueeze
Platforms and Indicators
Exit Strategy
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Just another trading journal: PA, Wyckoff & Trends
28 thanks
Tao te Trade: way of the WLD
24 thanks
Diary of a simple price action trader
21 thanks
My NQ Trading Journal
14 thanks
HumbleTraders next chapter
10 thanks
  #3 (permalink)
 kevinkdog   is a Vendor
 
Posts: 3,662 since Jul 2012
Thanks Given: 1,892
Thanks Received: 7,350


In your picture, on the red bar shown, you'd have the code:

buy next bar at high stop;



That will send an order, good for the entire next bar (the green bar where you want to enter).

So, your logic has to be setup so you know at the close of the red bar, what your plan is for the next (green) bar.

Follow me on Twitter Reply With Quote
Thanked by:
  #4 (permalink)
 
Hulk's Avatar
 Hulk 
Texas, USA
 
Experience: Advanced
Platform: TT, Custom
Trading: Futures, Spreads
Posts: 369 since May 2014
Thanks Given: 731
Thanks Received: 901


bmtfken View Post
Hi all, requesting help in EasyLanguage:

I've looked all over google and the
forums and no one can answer this.
And turning on intrabarordergeneration
does NOT help, it only buys at the end
of the current bar (missing the move)

See attached pic,
I want to buy a CURRENT bar as soon as
it crosses the previous bars range high,
immediately.
EDIT: That is to say that on a Daily chart, when the current bar crosses the last daily bar high, that I need a long entry immediately.

NOT at the close of the current bar.
NOT at the open of the next bar.

Easylanguage code seems so powerful that
it is hard to believe that E.L. can't do this.

If "(a current value)" > range[1] then
buy this bar at market; does NOT work.

Is that possible using separate conditions1 ,2 etc. using a Daily bar as the trigger and then a 1 tick bar for a long entry?
??

Ken

Basically, what Kevin said. You need to do 2 things:

1. Use IntraBarOrderGeneration=True in your code.
2. You need a stop order to be placed when the current bar closes.

So, lets assume the current bar range high is 1960 and you want to buy 1 tick above this high on the next bar (assuming 1 tick=0.25), you need to place a buy stop order at 1960.25 using this kind of syntax when the current bar closes.

 
Code
Buy next bar at 1960.25 stop;
By doing so, as soon as the current bar closes, you will see a buy stop market order is placed at 1 tick above the high and if the next bar gets to this high, it should get filled.

Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #5 (permalink)
 kevinkdog   is a Vendor
 
Posts: 3,662 since Jul 2012
Thanks Given: 1,892
Thanks Received: 7,350


Hulk View Post
Basically, what Kevin said. You need to do 2 things:

1. Use IntraBarOrderGeneration=True in your code.
2. You need a stop order to be placed when the current bar closes.

So, lets assume the current bar range high is 1960 and you want to buy 1 tick above this high on the next bar (assuming 1 tick=0.25), you need to place a buy stop order at 1960.25 using this kind of syntax when the current bar closes.

 
Code
Buy next bar at 1960.25 stop;
By doing so, as soon as the current bar closes, you will see a buy stop market order is placed at 1 tick above the high and if the next bar gets to this high, it should get filled.


You don't need IntraBarOrderGeneration=True. I always keep it to False.

Follow me on Twitter Reply With Quote
  #6 (permalink)
 
Hulk's Avatar
 Hulk 
Texas, USA
 
Experience: Advanced
Platform: TT, Custom
Trading: Futures, Spreads
Posts: 369 since May 2014
Thanks Given: 731
Thanks Received: 901


kevinkdog View Post
You don't need IntraBarOrderGeneration=True. I always keep it to False.

Thats true. Orders always generated at the close of the bar in this case so this isnt required.

Visit my NexusFi Trade Journal Reply With Quote
  #7 (permalink)
 kevinkdog   is a Vendor
 
Posts: 3,662 since Jul 2012
Thanks Given: 1,892
Thanks Received: 7,350


Hulk View Post
Thats true. Orders always generated at the close of the bar in this case so this isnt required.

If he wanted to use IBOG, I think he could do this on the green bar (please correct me if I am wrong):

INTRABARORDERGENERATION=TRUE;
If close>high[1] then buy this bar at market; //you might have to use "high" instead of "close"


But, you cannot backtest with this setup, where you can with the other approach.

Follow me on Twitter Reply With Quote
Thanked by:
  #8 (permalink)
 
Hulk's Avatar
 Hulk 
Texas, USA
 
Experience: Advanced
Platform: TT, Custom
Trading: Futures, Spreads
Posts: 369 since May 2014
Thanks Given: 731
Thanks Received: 901


kevinkdog View Post
If he wanted to use IBOG, I think he could do this on the green bar (please correct me if I am wrong):

INTRABARORDERGENERATION=TRUE;
If close>high[1] then buy this bar at market; //you might have to use "high" instead of "close"


But, you cannot backtest with this setup, where you can with the other approach.

You are right Kevin. IBOG isnt required in this case. The information required to make the trade decision is available at the close of the current bar so the next (in-progress) bar really doesnt need to decide anything.

I had written a strategy sometime back that was based on a range (momentum) bar chart and would fade the close of the current bar when certain conditions are met and I think I was getting confused because of that.

Visit my NexusFi Trade Journal Reply With Quote
  #9 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,433 since Apr 2013
Thanks Given: 481
Thanks Received: 1,627

It's fine to use "close" in your example as in realtime with IOG this will be the last tick that came in (i.e. on the tick that prints the high the close should have the same value).

Regards,
ABCTG


kevinkdog View Post
If he wanted to use IBOG, I think he could do this on the green bar (please correct me if I am wrong):

INTRABARORDERGENERATION=TRUE;
If close>high[1] then buy this bar at market; //you might have to use "high" instead of "close"


But, you cannot backtest with this setup, where you can with the other approach.


Follow me on Twitter Reply With Quote
Thanked by:
  #10 (permalink)
bmtfken
boca ration,fl/usa
 
Posts: 6 since Jul 2014
Thanks Given: 6
Thanks Received: 0


Thanks all, I will review my code and post back.

Reply With Quote




Last Updated on July 27, 2014


© 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