EasyLanguage Question

Discussion in 'Trading Software' started by tdefarlo, Apr 26, 2002.

  1. alain

    alain

    Those in India are good. They are not single programmers... they function as a little company have a project manager and 20 programmers. The team I'm working with do a lot of things for Microsoft.. and they also build some banking software for Swiss-Banks. They are good in coding.. but they need always a very clear documentation on what they have to do.

    may I contact you privatly.. I mean beside the board. I have some other questions.

    alain
     
    #11     Apr 27, 2002
  2. Sure.
     
    #12     Apr 27, 2002
  3. Kymar

    Kymar

    Though there are other ways to incorporate data from diverse time frames in a single signal or analysis technique, the simplest way that I can think of to determine the current day's range is simply to flag the first bar's high and low.

    For equities, a typical technique would run like this:

    INPUTS: MinRan(.75);
    {use of input statement allows further adjustments}
    VARS: HH(0), LL(0), CurRan(0), OKtoTrade(False);

    {flags high and low of first bar of day}
    If Date <> Date[1] then begin
    HH = H;
    LL = L;
    End;

    {determines current day's highest high and lowest low}
    If Date = Date [1] then begin
    if H > HH then HH = H;
    if L < LL then LL = L;

    CurRan = HH - LL;

    If CurRan > MinRan then OKtoTrade = True else OKtoTrade = False;

    {subsequent signals, analysis techniques, etc. would incorporate OKtoTrade condition}

    ****

    Personally, I'd prefer a MinRan that equaled a percentage of the price (to differentiate between .75 on a $60 stock vs. .75 on a $10 stock).


    Now please send $150 to your local ASPCA, animal rescue, or, if you prefer human beings, the Red Cross or something...
     
    #13     Apr 27, 2002
  4. Best bet is to create user functions so that you can reuse your IH/IL code in the future. Not sure if you are trading just stocks. If you trade something with an overnight session (think EMINI) you also need OH/OL.

    The most foolproof versions of the functions I have come up with are as follows (TS version 4.0 but should be similar to 6.0) Make sure to set the functions to series:

    ----------
    Code:
    {Function: IH}
    Vars: TmpHigh(0);
    
    	if (Time >=Sess1FirstBarTime and (Time[1] < Sess1FirstBarTime or Date <> Date[1]))  then begin
    		TmpHigh = High;
    		IH = TmpHigh;
    	end;
    
    
    	if (Time >=Sess1StartTime and Time <Sess2StartTime) and High > TmpHigh then begin
    		TmpHigh = High;
    		IH = TmpHigh;
    	end;
    {end Function: IH}
    
    {Function: IL}
    Vars: TmpLow(99999);
    
    	if (Time >=Sess1FirstBarTime and (Time[1] < Sess1FirstBarTime or Date <> Date[1])) then begin
    		TmpLow = Low;
    		IL = TmpLow;
    	end;
    
    
    	if (Time >Sess1StartTime and Time <Sess2StartTime) and Low < TmpLow then begin
    		TmpLow = Low;
    		IL = TmpLow;
    	end;
    {end Function: IL}
    
    {Function: OH}
    Vars: TmpHigh(0);
    
    	if (Time >=Sess2FirstBarTime and Time[1] < Sess2FirstBarTime)  then begin
    		TmpHigh = High;
    		OH = TmpHigh;
    	end;
    
    
    	if (Time > Sess1EndTime OR Time < Sess1StartTime) and High > TmpHigh then begin 
    		TmpHigh = High;
    		OH = High;
    	end;
    {end Function: OH}
    
    {Function: OL}
    Vars: TmpLow(99999);
    
    	if (Time >=Sess2FirstBarTime and Time[1] < Sess2FirstBarTime)  then begin
    		TmpLow = Low;
    		OL = TmpLow;
    	end;
    
    
    	if (Time > Sess1EndTime or Time < Sess1StartTime) and Low < TmpLow then begin 
    		TmpLow = Low;
    		OL = Low;
    	end;
    {end Function: OL}
    
    
    Then just create an indicator and do something like if IH - IL > .75 then begin...
     
    #14     Apr 27, 2002
  5. It can make things that look like they will make money but often it is just the limitations of the programming language that give that impression. It works well for charting the market and creating simple indicators. Whenever I need more control I take it to VB.
     
    #15     Apr 27, 2002
  6. Kymar

    Kymar

    1. TRIPACK's solution points to one of the other alternatives, esp. if you're not focusing strictly on stocks...

    2. The canned IDHIGH and IDLOW functions that come with TS6 are also stock-oriented functions - the IDHIGH goes like this:

    vars:htoday(0);

    htoday=htoday[1];

    if date>date[1] then htoday=0;

    if h>htoday then htoday=h;

    IDhigh=htoday;

    If that IS your focus, you could set up the simplest version of all in TS6 as:

    IDRAN = IDHIGH - IDLOW;
    If IDRAN > MinRan..., etc...

    3. Left out an "end" on my code (after second "begin") - but you (or your software if you just copied what I wrote) probably already noticed that.

    I'll include this as part of my first hour, for billing purposes.
     
    #16     Apr 27, 2002
  7. Janette Perez

    Janette Perez TradeStation Technologies

    In response to the original EasyLanguage® question posted by tdefarlo, here's the code:

    if CurrentBar = 1 or Date <> Date[1] then
    begin
    Value1 = High ;
    Value2 = Low ;
    Condition1 = false ;
    end
    else if Condition1 = false then
    begin
    if High > Value1 then
    Value1 = High ;
    if Low < Value2 then
    Value2 = Low ;
    end ;
    if Condition1 = false and Value1 - Value2 >= .75 then
    Condition1 = true ;

    if Condition1 and MyConditions then ...

    We are making available a series of one and two-day courses, taught by market knowledgeable instructors through EmpiricalEdge. You might be interested in attending "Becoming Fluent in TradeStation EasyLanguage". TradeStation Securities is offering its new and existing brokerage clients a monthly reimbursement plan for up to 50% of your previous month's gross commissions, as long as you continue to trade, until your tuition fees are fully reimbursed. You don’t need to be a brokerage client to attend. For full details, please visit http://www.empiricaledge.com/ee_schedule.htm.

    I also wanted to let you know that TradeStation Securities clients have access to a "Getting Started with TradeStation EasyLanguage", and an EasyLanguage certificate entitling them to a one-hour consultation with a TradeStation Technologies EasyLanguage Consultant.

    An additional resource for you may be the EasyLanguage Reference Manual. The guide details the capabilities of the language and its structure, using examples. To get your free copy of the EasyLanguage Reference guide, simply click on the download button on the following page.
    http://www.tradestation2000i.com/support/guide/default.shtm.


    I hope these suggestions have been helpful.

    Thanks,

    Janette Perez
    TradeStation Securities
     
    #17     Apr 29, 2002
  8. tdefarlo

    tdefarlo

    I'd like to thank everyone for the coding examples. It was very helpful. I have one other issue : I have Data1 set as intraday and data2 set as daily. I need to know what fastK is based on daily data, with the current last price acting as the closing price for the current daily bar. I suspect that when I do this, I am actually getting the fastK from the prior day's bar since the system seems to trigger many entries at exactly 1600.

    To summarize: does reference to data2 point to the current daily bar being built or does it refer to the last completed bar on the daily - i.e. yesterday's bar?

    If data2 does point only to the prior day's bar, how can one get current daily stochastic values which include today's price?
     
    #18     Apr 30, 2002
  9. PXG

    PXG

    The today's Close of Data2 is beeing referenced starting at 1600; before 1600 if you reference Close of Data2, it points to yesterday's close.
    A good way to find out what is beeing referenced is using a commentary:
    Commentary(Close of Data2);
    Put this line in your strategy, click on your chart with the commentary pointer, and you can find out what is beeing referenced.
    I don't use stochastics, but I guess you could customize the function to use Close of Data1 instead of Close of Data2.
     
    #19     Apr 30, 2002
  10. tdefarlo

    tdefarlo

    That's what I figured was happening. So the question is, how does one get the value of an indicator (in this case stochastic) which requires both daily data and the current price? For example, FastK(5) of data1 would return the stochastic value based on the last 5 intraday bars, which I do not want, while FastK(5) of data2 would only return the stochastic value based on 5 days up to yesterday's close. I am sure there is a way to do this - I just must misunderstand something...
     
    #20     Apr 30, 2002