[description = ONE MINUTE MANAGER - This indicator shows BOTOX (Best Of Three On eXit) ;author=Bleakley, Des;target=price;] roc_bars := 52; emasmooth := 10; MA5 := 5; MA_method := SIMPLE; TP_ATR_num := 3; close_hf := 6; max_bar_num := lastvalue(barnumber); lastbar := barnumber = max_bar_num; earlybar := barnumber < 65 ; { **** CALCULATE RAW AND SMOOTHED RATE OF CHANGE **** } boughtprice := hist(CLOSE, roc_bars); risetodate := CLOSE - boughtprice; risepc := (risetodate/boughtprice)*100; smoothpcS := ma( risepc, emasmooth, S); smoothpcE := ma( risepc, emasmooth, E); smoothpc_up_one := hist(smoothpcS,1) < smoothpcS; smoothpc_down_one := hist(smoothpcE,1) >= smoothpcE; smoothpc_up_two := hist(smoothpc_up_one,1) AND smoothpc_up_one; smoothpc_down_two := hist(smoothpc_down_one,1) AND smoothpc_down_one; { **** HAS BELL RUNG? **** } roc_st := roc(CLOSE,14,PERCENT); bell := cross(roc_st,0); bell_nearby := barssince(bell) <6 AND roc_st >0; { **** MA5 & HAPPY FACE NEARBY CALCULATIONS **** } MA5_down_one := hist(ma(CLOSE,MA5,MA_method),1) >= ma(CLOSE,MA5,MA_method); MA5_down_two := hist(MA5_down_one,1) AND MA5_down_one; MA5_up_one := hist(ma(CLOSE,MA5,MA_method),1) < ma(CLOSE,MA5,MA_method); MA5_up_two :=hist(MA5_up_one,1) AND MA5_up_one; ATR_profit_line := (ma(CLOSE,13,SIMPLE) + TP_ATR_num*ATR(21)); happy_face := C >= ATR_profit_line; happy_face_nearby := barssince(happy_face)< close_HF; last_HF_value := valuewhen(1,happy_face,CLOSE); first_HF := happy_face AND NOT hist(happy_face_nearby,1); { **** DEFINE ENTER AND EXIT CONDITIONS **** } en_2 := MA5_up_two AND smoothpc_up_two; en_3 := MA5_up_two AND smoothpc_up_one AND bell_nearby; ex_1 := MA5_down_one AND smoothpc_down_one ; ex_2 := happy_face_nearby AND MA5_down_one AND CLOSE= HHV(Close,close_HF); ex_3 := happy_face_nearby AND smoothpc_down_one AND CLOSE= HHV(Close,close_HF); exitcondition := NOT WHITE AND (ex_1 OR ex_2 OR ex_3); entercondition := NOT exitcondition AND WHITE AND (en_2 OR en_3) AND NOT first_HF ; no_action := NOT (exitcondition OR entercondition); { **** ARE WE IN OR OUT OF THE MARKET? **** } INMKT := if( earlybar, FALSE, if( prev AND exitcondition, FALSE, if( NOT prev AND entercondition, TRUE, prev))); { **** CHANGE FROM INMKT TO NOT INMKT DEFINES BUY/SELL SIGNALS - LONG SYSTEM **** } buysignal := NOT hist(INMKT,1) AND INMKT; sellsignal := hist(INMKT,1) AND NOT INMKT; { **** DISPLAY ENTRY / EXIT ARROWS IF APPROPRIATE **** } [{Name = SAPinlb;} Linestyle = marker; color=green;marker = type13;size=large;]; lastbar AND entercondition; [{Name = SAPin; }Linestyle = marker; color=green;marker = type13;size=tiny;]; NOT lastbar AND entercondition; [{Name = SAPoutlb;}linestyle=marker;marker=type14;color=red;size=large]; lastbar AND exitcondition; [{Name = SAPout;}linestyle=marker;marker=type14;color=red;size=tiny]; NOT lastbar AND exitcondition; [{Name = NO-ACTION;}linestyle=marker;marker=type12;color=orange;size=large]; lastbar AND no_action; [{Name = NO-ACTIONt;} Linestyle = text; color=blue;font=14;fontstyle=bold;]; [color=orange]; if (lastbar AND no_action," HOLD "+security.symbol,undefined);close; [color=green]; if (lastbar AND entercondition, " BUY "+security.symbol,undefined);close; [color=red]; if (lastbar AND exitcondition, " SELL "+security.symbol+" NOW",undefined);close;