EA with custom indicator

 
Can someone help me? I want to use the super trend indicator in my EA. If the trend is down he should open a sell trade and if the trend is up he should open a buy trend. I only need this simple method to understand the logic about that because I never work with an indicator and yes I am a beginner :D This indicator is not mine !
Files:
 

I dont like how that supertrend is coded.

 
SDC:

I dont like how that supertrend is coded.

Can you explain ?
 
Yes it redraws the entire chart on every tick plus it uses some static arrays in the calculations that are limited to 5000 indexes I'm suprised it doesnt cause array out of range, and I dont like the way it draws a line between the trends when the trend changes.
 
SDC:
Yes it redraws the entire chart on every tick plus it uses some static arrays in the calculations that are limited to 5000 indexes I'm suprised it doesnt cause array out of range, and I dont like the way it draws a line between the trends when the trend changes.

Can you recommend another indicator to identify the trend ?
 
Try it
 
Try it. Very good.
Files:
 
Thank you Iwori Fx but I dont like these indicators ..
 
Faat94:

Can you recommend another indicator to identify the trend ?
I think I would prefer to use PSAR but you can use the supertrend one you have, it does work, My criticism of it was looking at it from a coding point of view.
 

https://docs.mql4.com/indicators/icustom

But how can I Say to my EA if TrendUp do this and if the Trend is Down do this ? The indicator could be extern.

double val=iCustom(NULL,0,"super-trend",13,1,0);

How can I define if the trend is up or down ?

Reason: