Jump to content

Welcome to the new Traders Laboratory! Please bear with us as we finish the migration over the next few days. If you find any issues, want to leave feedback, get in touch with us, or offer suggestions please post to the Support forum here.

  • Welcome Guests

    Welcome. You are currently viewing the forum as a guest which does not give you access to all the great features at Traders Laboratory such as interacting with members, access to all forums, downloading attachments, and eligibility to win free giveaways. Registration is fast, simple and absolutely free. Create a FREE Traders Laboratory account here.

v101

PeriodHighLow Tradestation indicator Help

Recommended Posts

Hello;

I am a newbie at Tradestation development. I am trying to develop a simple indicator so I can input overnight start times and overnight end times and have Tradestation plot the high and low from this time period. 

 

I have tried a few different ways, having some success, but not doing exactly what I want. 

 

Here is the first code I tried to develop:

Inputs:    Starttime (1630),
        EndTime ( 0930);
        
        
Vars:    PeriodHigh(0),
        LastPeriodHigh (0),
        PeriodLow(999999),
        LastPeriodLow (999999);
        
If T > Starttime and T < EndTime then
Begin
    If H > PeriodHigh then PeriodHigh = H;
    If L < PeriodLow then PeriodLow = L;
    End;
    

Plot1( PeriodHigh );
Plot2( PeriodLow );
 

This seems to work, but doesn't catch the Low's for some unknown reason see the screen shot. PLOT1 appears to have caught the HIGH, but PLOT2 isn't correctly plotting the time period LOW. 

So I modified some other code I have and tried indicator version2 a bit different, but here is what I tried doing:

 

inputs:
    int ONightStart( 1630 ),    //The start time of user defined session
    int ONightEnd( 0930 ),        //The end time of a user defined session
    OverNightSession(1),        // Plot overnight session HIGH / LOW
    OffSetF(.0005), 
    LookBack(25);

vars:
    Var0( 0),
    bool ONightSession( False ), // True when in Overnight Session
    bool InSession( False );    // True when in session

begin
    ;
    ;
    Var0 =  CLOSE  * OffSetF;
    If T > ONightStart and T < ONightEnd then ONightSession = True;
    Begin
    
        If OverNightSession = 1 and ONightSession = True then  begin
            If HIGHD( 0) <= HIGHEST( HIGH  + Var0, LookBack) and HIGHD( 0) >= LOWEST( LOW  - Var0, LookBack) then  PLOT2 (HIGHD( 0), "OvernightHigh");
            If LOWD( 0) <= HIGHEST( HIGH  + Var0, LookBack) and LOWD( 0) >= LOWEST( LOW  - Var0, LookBack) then  PLOT3 (LOWD( 0), "OvernightLow");
            end;

 

However when I try to apply this, I get nothing on the screen. Is this because I am trying to use the HIGHD keyword? is the reason it plots nothing because the session time, doesn't have the HIGHD data?

 

Any help is appreciated. 

 

 

 

 

Screen Shot 2019-11-25 at 8.23.14 AM.png

Share this post


Link to post
Share on other sites

Hi,

StartTime(1630) // 430 PM

EndTIme(930) // 930 AM

If T > ONightStart and T < ONightEnd then ONightSession = True; 

Time cannot be greater than 430 PM less than 930 AM(since we haven't mentioned any Date).

Try this:-

If T > ONightStart OR T < ONightEnd then ONightSession = True; 

 

Goodluck.

Mani.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Topics

  • Posts

    • VCYT Veracyte stock, watch for an ascending triangle breakout at https://stockconsultant.com/?VCYT
    • TGI Triumph stock, watch for a narrow range breakout at https://stockconsultant.com/?TGI
    • GRMN Garmin stock, watch for a top of range breakout above 220.91 at https://stockconsultant.com/?GRMN
    • CORT Corcept Therapeutics stock, watch for a top of range breakout at https://stockconsultant.com/?CORT
    • Date: 29th January 2025.   Market Recap: Treasury Yields Rise as Tech Stocks Rebound.   Asia & European Sessions: Markets had largely recovered from Monday’s selloff triggered by fears over AI competition from China’s DeepSeek. Dip buyers took advantage of the NASDAQ’s sharp decline, leading to a rebound of 2.03%, which erased much of Monday’s 3.07% drop. The S&P500 climbed 0.92% after shedding 1.46% the previous day, while the Dow inched up 0.31%. Asian stocks and European equity futures increased following Wall Street’s tech-driven recovery. Japanese, Australian, and Indian markets saw gains, though many regional exchanges remained closed for Lunar New Year celebrations. Nvidia regained nearly half of its 17% plunge, which had marked the largest single-day market cap loss in history. As investor anxiety eased, the VIX volatility index dropped 8.66% to 16.35, after briefly touching 21 on Monday. Positive earnings from Visa, Royal Caribbean, and Boeing helped lift sentiment, though JetBlue and General Motors disappointed. Market attention is now turning to the Federal Reserve’s interest rate decision and earnings reports from major tech firms. The Fed is universally expected to leave rates unchanged at a 4.375% mid-range, taking a pause after three consecutive easings totalling -100 bps since the jumbo -50 bps in September. The resilient economy and still sticky inflation do not give the Fed room to credibly continue with its policy course. And we do not expect any surprises from Chair Powell's press conference where he should stress the economy remains solid, with risks to inflation and employment generally in balance. Upcoming earnings: Microsoft, Tesla, Meta, IBM, ASML, ADP and Apple on Thursday.   Financial Markets Performance: USOIL rose 0.97% to $73.50 per barrel, while gold climbed 0.88% to $2,764 per ounce. Aussie weakened, while 3-year bond yields dropped 5 bps on expectations of monetary easing. Australia’s core inflation cooled more than expected in the Q4 2024, prompting speculation that the RBA may soon pivot to rate cuts. Always trade with strict risk management. Your capital is the single most important aspect of your trading business.   Please note that times displayed based on local time zone and are from time of writing this report.   Click HERE to access the full HFM Economic calendar.   Want to learn to trade and analyse the markets? Join our webinars and get analysis and trading ideas combined with better understanding of how markets work. Click HERE to register for FREE!   Click HERE to READ more Market news. Andria Pichidi HFMarkets Disclaimer: This material is provided as a general marketing communication for information purposes only and does not constitute an independent investment research. Nothing in this communication contains, or should be considered as containing, an investment advice or an investment recommendation or a solicitation for the purpose of buying or selling of any financial instrument. All information provided is gathered from reputable sources and any information containing an indication of past performance is not a guarantee or reliable indicator of future performance. Users acknowledge that any investment in Leveraged Products is characterized by a certain degree of uncertainty and that any investment of this nature involves a high level of risk for which the users are solely responsible and liable. We assume no liability for any loss arising from any investment made based on the information provided in this communication. This communication must not be reproduced or further distributed without our prior written permission.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.