in Search

I can't get Chandelier Exit to work

Last post 07-27-2009, 20:29 by dct73. 5 replies.
Sort Posts: Previous Next
  •  07-26-2009, 12:57 30269

    I can't get Chandelier Exit to work

    I have a simple long only entry (C-Ref(C,-60))/ATR(60)>10 and MOV(V,30,S)>50000 and C>MOV(C,200,S) and am trying to cut and paste the chandelier exit from Jose as shown below

    { User Inputs }
    multi:=Input("ATR multiplier",0,10,2.5);
    pds:=Input("ATR periods",1,252,10);
    pds1:=Input("ATR lookback periods",1,252,21);
    plot:=Input("[1]Trailing Stop, [2]Long+Short, [3]Signals",1,3,1);
    adv:=Input("plot: today's trailing stop=0, tomorrow's stop=1",0,1,0);
    delay:=Input("Entry and Exit signal delay",0,5,0);

    { Trailing Stops }
    StLong:=HHV(C-multi*Mov(ATR(1),pds,E),pds1);
    StShort:=LLV(C+multi*Mov(ATR(1),pds,E),pds1);
    stopLong:=If(C<PREV,StLong,Max(StLong,PREV));
    stopShort:=If(C>PREV,StShort,Min(StShort,PREV));

    into the "Sell Order" tab. I keep getting an error stating "This function is not allowed
    in this type of formula." The cursor then blinks in front of "Input ("ATR multiplier",0,10,2.5);

    Would somebody please give a newbie a hand?

    Thanks

  •  07-26-2009, 20:23 30272 in reply to 30269

    Re: I can't get Chandelier Exit to work

    Hi dct,

    Welcome to the Forum.

    The Input() function can only be used in indicators; it cannot be used in Explorations, Experts or System Tests.

    Replace the Input() function by simply assigning the value you want to use to the variable e.g.

    Instead of

    Code:
    multi:=Input("ATR multiplier",0,10,2.5);


    use

    Code:
    multi:=2.5;



    Hope this helps.

    wabbit Big Smile [:D]





    "The question of whether a computer can think is no more interesting than the question of whether a submarine can swim."
    Edsgar W. Dijkstra

     

    MS: 6.52 EOD, 7.x EOD, 8.0 PRO, 9.2 PRO w/QC, 10 PRO w/QC C, 11 PRO w/QC & MDK
    For custom MetaStock programming : http://www.wabbit.com.au
    My SkyPE status :
    My SkyPE account : wabbit.com.au

  •  07-27-2009, 12:44 30291 in reply to 30272

    Re: I can't get Chandelier Exit to work

    Thanks. Then it appears most of that code is unnecessary. Is this all I need to trigger a sell?

    multi:=2.5;
    pds:=10;
    pds1:=21;
    { Trailing Stops }
    StLong:=HHV(C-multi*Mov(ATR(1),pds,E),pds1);
    C<StLong;

    I feel I'm missing something in this line I left out:
    "StopLong: = If(C<PREV,StLong,Max(StLong,PREV));"

    Correct me if I'm wrong,
    If C<Prev, then StopLong=StLong
    If C>=Prev, then StopLong= the greater of StLong and Prev. Does this "Prev" apply to StLong or StopLong?   I just can't understand why I need this line.

  •  07-27-2009, 13:05 30293 in reply to 30291

    Re: I can't get Chandelier Exit to work

    Wow.  I'm really missing the boat here.  With what I have if I enter on a dip, my entry could be below  my stop!  How do I keep the HHV from looking back previous to my entry?
  •  07-27-2009, 17:48 30294 in reply to 30293

    Re: I can't get Chandelier Exit to work

    Although the Chandelier Exit is a great programming exercise in MS, you are missing some of the critical concepts in the execution of your version; I don't have time this morning to go through them all, suffice to say check out Richard Dale's Advanced Stops solution at http://www.tradernexus.com/

    Hope this helps.

    wabbit Big Smile [:D]


    "The question of whether a computer can think is no more interesting than the question of whether a submarine can swim."
    Edsgar W. Dijkstra

     

    MS: 6.52 EOD, 7.x EOD, 8.0 PRO, 9.2 PRO w/QC, 10 PRO w/QC C, 11 PRO w/QC & MDK
    For custom MetaStock programming : http://www.wabbit.com.au
    My SkyPE status :
    My SkyPE account : wabbit.com.au

  •  07-27-2009, 20:29 30297 in reply to 30294

    Re: I can't get Chandelier Exit to work

    Thanks wabbit.  That's a great link. 


View as RSS news feed in XML