iCustom only reading one buffer?

 

I'm trying to create a EA for the attached indi, and even if it turns out unprofitable / unreliable - I REALLY need to understand what I've been doing wrong at this point.

Sorry in advance for my coding style - complete noob here :-)


The EA will only acknowledge sell signals for some reason (Buffer #4 of the indi...technically 3 counting from 0)


void checkup() {
STUP = 0;
STUP = iCustom(NULL,0,"XXSupertrend",10,4.0,2,1);

    if(STUP != 2147483647 && STUP != 0) {
...
         }
}

void checkdown() {
STDOWN = 0;
STDOWN = iCustom(NULL,0,"XXSuperTrend",10,4.0,3,1);

         
    if(STDOWN != 2147483647 && STDOWN != 0) {
...
         }

}

During OnTick() I run both functions and inside the IF statement I would place the order / or verify with other indicators / check how many order are open etc...


Am I missing something really obvious @ iCustom or is the problem with the indicator, perhaps?


Please help !

Thanks

Files:
 

There is no particular problem. It works normally.

If no, there may be a mistake in other part.

However, I think

if (STUP != EMPTY_VALUE)    is better than

if (STUP != 2147483647 && STUP != 0)

 
Naguisa Unada:

There is no particular problem. It works normally.

If no, there may be a mistake in other part.

However, I think

if (STUP != EMPTY_VALUE)    is better than

if (STUP != 2147483647 && STUP != 0)

Well, it does not seem to work in the back-test...ie. only SELL orders are created


As to STUP I was just re-setting it to zero every tick, just in case...the whole code is a bit messy now but the logic *should* be fine so I am really confused :/

 
danielkaye589:

I'm trying to create a EA for the attached indi, and even if it turns out unprofitable / unreliable - I REALLY need to understand what I've been doing wrong at this point.

Sorry in advance for my coding style - complete noob here :-)


The EA will only acknowledge sell signals for some reason (Buffer #4 of the indi...technically 3 counting from 0)


During OnTick() I run both functions and inside the IF statement I would place the order / or verify with other indicators / check how many order are open etc...


Am I missing something really obvious @ iCustom or is the problem with the indicator, perhaps?


Please help !

Thanks

If you are using the super trend that is available as free indicator then there is no buffer 3 (ie 4th buffer)

Check the indicator that you are calling what buffers does it have

 
Mladen Rakic:

If you are using the super trend that is available as free indicator then there is no buffer 3 (ie 4th buffer)

Check the indicator that you are calling what buffers does it have

Its a modified version (attached) so the first 2 buffers are for the lines and the other 2 buffers are for the arrows...Where I am trying to place orders via the arrows


//---- indicators
   SetIndexBuffer(0,TrendUp);
   SetIndexStyle(0,DRAW_LINE,1,1);
   SetIndexLabel(0,"Trend Up");
   SetIndexBuffer(1,TrendDown);
   SetIndexStyle(1,DRAW_LINE,1,1);
   SetIndexLabel(1,"Trend Down");

   SetIndexStyle(2,DRAW_ARROW,EMPTY);
   SetIndexStyle(3,DRAW_ARROW,EMPTY);

   SetIndexBuffer(2,UpBuffer);
   SetIndexBuffer(3,DnBuffer);

   SetIndexArrow(2,233);
   SetIndexArrow(3,234);

   SetIndexLabel(2,"Up Signal");
   SetIndexLabel(3,"Down Signal");

//----
Reason: