Arrows and Alert not functioning

 

I have this indicator, and i was working on alert function and to display arrows when signal is valid. Alert function works, but only for 1 pair (not on other 5 pairs i have open then), so i think this has to do with the "if (TimeCurrent() > allowAlert)" command.

Arrows same thing, appear one time on one chart, then nothing. Also arrows seem to be switched (sell arrow, while the alert text says buy and otherwise).

How to fix this so that my arrows and alert function work properly?

Files:
 
  1. The code includes my code for 5 digit brokers in Init, and then also in Start. Redundant.
  2. It creates objects in init. If a template is applied after, the code breaks. Use the form if(objectModify(...)) else if (!objectCreate) Alert(...) else if (objectSet...
  3. atrvalue=iATR(NULL,0,20,1)*10000;
    You've already included the 5 digit code, so why are you including hard numbers?
    atrvalue=iATR(NULL,0,20,1)/pip2dbl;

  4.    if (NormalizeDouble(hhll5,0)< ...
    These normalize are unnecessary
  5. if (TimeCurrent() > allowAlert){ allowAlert=TimeCurrent()+ 240*60; 
         Alert("BUY Alert! Place BUY stop orders for "+Symbol());}
    
    This prevents alert more then 240 minutes (once every 4 days.) Once every 4 hours would be 4*60 or +240 total.
 
WHRoeder:
  1. The code includes my code for 5 digit brokers in Init, and then also in Start. Redundant.
  2. It creates objects in init. If a template is applied after, the code breaks. Use the form if(objectModify(...)) else if (!objectCreate) Alert(...) else if (objectSet...
  3. You've already included the 5 digit code, so why are you including hard numbers?
  4. These normalize are unnecessary
  5. This prevents alert more then 240 minutes (once every 4 days.) Once every 4 hours would be 4*60 or +240 total.
1. if (Digits == 5 || Digits == 3)
{ // Adjust for five (5) digit brokers.
pips2dbl = Point*10; pips2points = 10; Digits.pips = 1;

} else { pips2dbl = Point; pips2points = 1; Digits.pips = 0; }

is the same as this? :

//++++ These are adjusted for 5 digit brokers.
double pips2points, // slippage 3 pips 3=points 30=points
pips2dbl; // Stoploss 15 pips 0.0015 0.00150

int Digits.pips; // DoubleToStr(dbl/pips2dbl, Digits.pips)

2. dont follow it... sry. can you explain with code?

3. found it too finally :) changed now to /pips2dbl

4. didnt know for sure, but removed them now

5. great, i thought the 60 were the seconds :)

Thanks again for helping!

 
  1. //++++ These are adjusted for 5 digit brokers.
    double  pips2points,    // slippage  3 pips    3=points    30=points
            pips2dbl;       // Stoploss 15 pips    0.0015      0.00150
    int     Digits.pips;    // DoubleToStr(dbl/pips2dbl, Digits.pips)
    int     init(){
        if (Digits == 5 || Digits == 3){    // Adjust for five (5) digit brokers.
                    pips2dbl    = Point*10; pips2points = 10;   Digits.pips = 1;
        } else {    pips2dbl    = Point;    pips2points =  1;   Digits.pips = 0; }
        // OrderSend(... Slippage.Pips * pips2points, Bid - StopLossPips * pips2dbl
    
    What's your question?
  2. dont follow it... sry. can you explain with code?
    I did: "if(objectModify(...)) else if (!objectCreate) Alert(...) else if (objectSet..." If you create an object in init() and it gets destroyed by adding a template, then your objectSet() in start() fails.
    void TLine( string name, datetime T0, double P0, datetime T1, double P1
              , color clr, bool ray=false ){        #define WINDOW_MAIN 0
        /**/ if(ObjectMove( name, 0, T0, P0 ))      ObjectMove(name, 1, T1, P1);
        else if(!ObjectCreate( name, OBJ_TREND, WINDOW_MAIN, T0, P0, T1, P1 ))
            Alert("ObjectCreate(",name,",TREND) failed: ", GetLastError() );
        else if (!ObjectSet( name, OBJPROP_RAY, ray ))
            Alert("ObjectSet(", name, ",Ray) failed: ", GetLastError());
        /**/ if (!ObjectSet(name, OBJPROP_COLOR, clr )) // Allow color change
            Alert("ObjectSet(", name, ",Color) [2] failed: ", GetLastError() );
    }
    
 
You know how to get working arrows which keep on the chart (so you can look back and still see them), WHRoeder? im not familiar with buffers. its the one thing i really want to work
Reason: