Announcement

Collapse
No announcement yet.

triigger condition

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

  • triigger condition

    I cannot make any sense of the formula wizard. How do I have a two-part EFS - set trigger condition #1 and then trade when trigger #2 fires?

    When oscillator > X, and then price crosses below zero, sell the market.

    Stay that way until oscillator < -X and then price crosses back above zero, buy the market.

    draw over market price. Back test results.

  • #2
    Re: triigger condition

    mkahn
    If these conditions are separated by an unspecified number of bars [ie you cannot define both events within the context of the same condition] then you will not be able to use the Formula Wizard to accomplish what you want as it requires creating global variables (ie variables that are declared ouside of a function that persist between iterations of the efs) which the Formula Wizard cannot do
    You would need to write this using the EFS Editor and the logic required would be somewhat similar to the example enclosed below (note that this is just a basic routine to illustrate the logic)
    Alex

    PHP Code:
    //declare a global variable called TradeSetup and set it initially to false eg
    //var TradeSetup = false;
     
    //then in your main function you would set the required conditions
    if(myOscillator x){
        
    TradeSetup true;
    }
    if(
    TradeSetup && myOscillator && !Strategy.isShort()){
        
    Strategy.doShort(...)
        
    TradeSetup false;
    }
    if(
    myOscillator < -x){
        
    TradeSetup true;
    }
    if(
    TradeSetup && myOscillator && !Strategy.isLong()){
        
    Strategy.doLong(...)
        
    TradeSetup false;


    Originally posted by mkahn
    I cannot make any sense of the formula wizard. How do I have a two-part EFS - set trigger condition #1 and then trade when trigger #2 fires?

    When oscillator > X, and then price crosses below zero, sell the market.

    Stay that way until oscillator < -X and then price crosses back above zero, buy the market.

    draw over market price. Back test results.

    Comment

    Working...
    X