Announcement

Collapse
No announcement yet.

Study Based on Time

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Study Based on Time

    I need some help in writing a study the would be based upon two things: the previous day's close and time.

    For instance at a certain time if the price was above the previous day's close I would go long and exit at a certain time.

    Conversely, at a certain time if the price was below the prior day's close I would go short and exit at a certain time.

    If possible, I would like to be able to change the trade directions and the times.

    Thanks.

    Bruce

    P.S. I tried creating it myself but to be honest this one (and most of them) are above my ability.
    Attached Files

  • #2
    Bruce
    To define a specific time or a time range you can use the following conditional statements
    PHP Code:
    if((getHour(0)*100)+getMinute(0) == your_time)//if at a specific time for example 945 for 9:45
    //or
    if((getHour(0)*100)+getMinute(0) > your_start_time && (getHour(0)*100)+getMinute(0) < your_end_time)//if within a time range 
    To determine if the current value is above or below yesterday's Close you can use the following conditional statements
    PHP Code:
    if(close(0) > close(-1,inv("D")))//if above yesterday's daily Close
    if(close(0) < close(-1,inv("D")))//if below 
    Based on the examples shown above you should be able to write your own conditions upon which to execute your commands
    Alex

    Comment

    Working...
    X