NexusFi: Find Your Edge


Home Menu

 





Need EasyLanguage help with HighD(1)


Discussion in TradeStation

Updated
      Top Posters
    1. looks_one 10handles with 4 posts (0 thanks)
    2. looks_two kevinkdog with 3 posts (1 thanks)
    3. looks_3 DeanJ with 1 posts (1 thanks)
    4. looks_4 ABCTG with 1 posts (1 thanks)
    1. trending_up 4,615 views
    2. thumb_up 3 thanks given
    3. group 3 followers
    1. forum 8 posts
    2. attach_file 1 attachments




 
Search this Thread
  #1 (permalink)
 10handles 
San Francisco CA
 
Experience: Beginner
Platform: TradeStation
Trading: Options
Posts: 10 since Apr 2014
Thanks Given: 4
Thanks Received: 2

I'm trying to create a simple strategy to enter long on an intraday close over yesterday's high. This code is returning long entries below the prior day's high. Any ideas why?

If close > HighD(1) then buy next bar at market;

Thank you.


Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
April CPI Preview: +3.7% YoY Expected at 8:30 AM ET -- C …
Traders Hideout
Peace Deal Forward Curve: May 22%, June 51%, December 81 …
Prediction Markets & Event Contracts
The Ceasefire Curve: 2pct Peace by Next Week, 60pct by S …
Prediction Markets & Event Contracts
S&P 500 Holds the Line: No Fast Track for SpaceX, Op …
Stocks and ETFs
World Cup Opens: USA at 45.5% Tonight as Markets Push Ba …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Big Mike in Ecuador
205 thanks
Sober Journey With S&P
21 thanks
30 Sessions
20 thanks
Volume Indicators
8 thanks
Thanks Mike. Godspeed.
7 thanks
  #2 (permalink)
 kevinkdog   is a Vendor
 
Posts: 3,737 since Jul 2012
Thanks Given: 1,917
Thanks Received: 7,476


10handles View Post
I'm trying to create a simple strategy to enter long on an intraday close over yesterday's high. This code is returning long entries below the prior day's high. Any ideas why?

If close > HighD(1) then buy next bar at market;

Thank you.

Can you show an example where this is not working as you expect?

Maybe you want this: If close > HighD(1) then buy next bar at HighD(1) limit;


Follow me on X Reply With Quote
  #3 (permalink)
 10handles 
San Francisco CA
 
Experience: Beginner
Platform: TradeStation
Trading: Options
Posts: 10 since Apr 2014
Thanks Given: 4
Thanks Received: 2



kevinkdog View Post
Can you show an example where this is not working as you expect?

Maybe you want this: If close > HighD(1) then buy next bar at HighD(1) limit;

Thanks Kevin. That didn't solve the problem. Here's a screenshot. Yellow lines are prior session high.


Started this thread Reply With Quote
  #4 (permalink)
 kevinkdog   is a Vendor
 
Posts: 3,737 since Jul 2012
Thanks Given: 1,917
Thanks Received: 7,476


10handles View Post
Thanks Kevin. That didn't solve the problem. Here's a screenshot. Yellow lines are prior session high.



Trade 2 is doing exactly what it is supposed to: If the close at end of day is greater than the previous high, then buy at the open of the next bar. The decision to buy is made at the close of the day, regardless of a gap down at the start of the next day.

What about "if open next bar > highd(1) then buy this bar at market" or "if open next bar > highd(1) then buy this bar at close" (I did not test, you'll have to check this)


Follow me on X Reply With Quote
  #5 (permalink)
 DeanJ 
St Louis MO
 
Experience: Intermediate
Platform: tradestation
Trading: stocks
Posts: 8 since May 2011
Thanks Given: 3
Thanks Received: 2

I think all 3 trades are doing what they are supposed to do. Your statement close>HighD(1) says at the close of any bar, whether it is at the end of the day or in the middle of the day, if the close of that bar is higher than yesterday's High it is supposed to buy on the next bar. Doesn't matter if the next bar is the middle of the day or it is the first bar on the next day.


Reply With Quote
Thanked by:
  #6 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,448 since Apr 2013
Thanks Given: 494
Thanks Received: 1,642

10handles,

you might want to exclude the last bar of each session from triggering trades, as the fill will occur on the next session. You can either use an input or a fixed time like "if Time < 1600" or use the SessionEndTime reserved word to get the end time for the particular session.

Regards,
ABCTG


10handles View Post
Thanks Kevin. That didn't solve the problem. Here's a screenshot. Yellow lines are prior session high.



Follow me on X Reply With Quote
Thanked by:
  #7 (permalink)
 10handles 
San Francisco CA
 
Experience: Beginner
Platform: TradeStation
Trading: Options
Posts: 10 since Apr 2014
Thanks Given: 4
Thanks Received: 2

Thank you Kevin, ABCTG and Dean.

Yes the last bar was causing the problem. The workaround I used for now is to add "If marketposition = 0" as a condition since I have it send to exit at the end of the session.

I know very little about EL/coding so it will take me some time to figure out how to exclude the last bar of each session but that is probably the better solution since I may want to explore a different exit strategy then session end.

Best regards.


Started this thread Reply With Quote
  #8 (permalink)
 kevinkdog   is a Vendor
 
Posts: 3,737 since Jul 2012
Thanks Given: 1,917
Thanks Received: 7,476


10handles View Post
Thank you Kevin, ABCTG and Dean.

Yes the last bar was causing the problem. The workaround I used for now is to add "If marketposition = 0" as a condition since I have it send to exit at the end of the session.

I know very little about EL/coding so it will take me some time to figure out how to exclude the last bar of each session but that is probably the better solution since I may want to explore a different exit strategy then session end.

Best regards.


Simple. Say the time of the last bar of the day is 1600.. then do this:

If time<1600 then begin

' your entry code

end;

That will prevent an entry based on that last bar


Follow me on X Reply With Quote
Thanked by:
  #9 (permalink)
 10handles 
San Francisco CA
 
Experience: Beginner
Platform: TradeStation
Trading: Options
Posts: 10 since Apr 2014
Thanks Given: 4
Thanks Received: 2


kevinkdog View Post
Simple. Say the time of the last bar of the day is 1600.. then do this:

If time<1600 then begin

' your entry code

end;

That will prevent an entry based on that last bar

Super, thanks Kevin!


Started this thread Reply With Quote




Last Updated on October 23, 2015


© 2026 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 - Downloads - Top
no new posts