Announcement

Collapse
No announcement yet.

trading based on a certain time of day

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

  • trading based on a certain time of day

    I am trying to backtest a forex theory that is to short at IE 10pm and close at 11pm

    the formula I wrote triggers the alert but in backtesting nothing happens

    I enclose my formula and would appreciate feedback or if there is some other scrips written anywhere in the forum that I could see and maybe edit to match my needs

    thanks
    Last edited by richbois; 07-19-2005, 04:49 PM.

  • #2
    Richard
    Following is an example of how you could do it
    Alex

    PHP Code:
    if((getHour()*100)+getMinute()==2200){
            if(!
    Strategy.isShort()){
                
    Strategy.doShort("Short",Strategy.MARKET,Strategy.THISBAR)
            }
        }
        if((
    getHour()*100)+getMinute()==2300){
            if(
    Strategy.isShort()){
                
    Strategy.doCover("Cover",Strategy.MARKET,Strategy.THISBAR)
            }
        }
        if(
    Strategy.isShort()) setBarBgColor(Color.red); 

    Comment


    • #3
      you did it again

      thank you again for your quick and great reply

      Comment

      Working...
      X