.

Re: Coding Help

#1071
mrtools wrote:
Tue Nov 19, 2019 11:36 am
schemman wrote:
Tue Nov 19, 2019 10:01 am
Dear experts,

I was trying to code a simple EA with the "Super smoothed average trend 1.2" by Jimmy, which is an indicator in the Top 10 NRP indicators list in here (attached below for ease of access). The idea is to make a buy order when the indicator turns Green (by default) and sell order vice versa. I was trying to find the indicator values using iCustom function during backtesting as shown below.

Code: Select all

#include <stdlib.mqh>

extern int                AvgPeriod1 = 34;
extern ENUM_APPLIED_PRICE AvgPrice1 = PRICE_CLOSE;

void OnTick()
{  
   double CustomIndi0 = iCustom(Symbol(), 15, "Super smoothed average trend 1.2", AvgPeriod1, AvgPrice1, 0, 1);
   Print("The value of Indicator Buffer 0 is: ", CustomIndi0);
   double CustomIndi1 = iCustom(Symbol(), 15, "Super smoothed average trend 1.2", AvgPeriod1, AvgPrice1, 1, 1);
   Print("The value of Indicator Buffer 1 is: ", CustomIndi1);
   double CustomIndi2 = iCustom(Symbol(), 15, "Super smoothed average trend 1.2", AvgPeriod1, AvgPrice1, 2, 1);
   Print("The value of Indicator Buffer 2 is: ", CustomIndi2);
   double CustomIndi3 = iCustom(Symbol(), 15, "Super smoothed average trend 1.2", AvgPeriod1, AvgPrice1, 3, 1);
   Print("The value of Indicator Buffer 3 is: ", CustomIndi3);
   double CustomIndi4 = iCustom(Symbol(), 15, "Super smoothed average trend 1.2", AvgPeriod1, AvgPrice1, 4, 1);
   Print("The value of Indicator Buffer 4 is: ", CustomIndi4);
   double CustomIndi5 = iCustom(Symbol(), 15, "Super smoothed average trend 1.2", AvgPeriod1, AvgPrice1, 5, 1);
   Print("The value of Indicator Buffer 5 is: ", CustomIndi5);
   double CustomIndi6 = iCustom(Symbol(), 15, "Super smoothed average trend 1.2", AvgPeriod1, AvgPrice1, 6, 1);
   Print("The value of Indicator Buffer 6 is: ", CustomIndi6);
   double CustomIndi7 = iCustom(Symbol(), 15, "Super smoothed average trend 1.2", AvgPeriod1, AvgPrice1, 7, 1);
   Print("The value of Indicator Buffer 7 is: ", CustomIndi7);
   double CustomIndi8 = iCustom(Symbol(), 15, "Super smoothed average trend 1.2", AvgPeriod1, AvgPrice1, 8, 1);
   Print("The value of Indicator Buffer 8 is: ", CustomIndi8);
 } 
When I execute this, it returns Empty_Value in Line Index 2 and 3, while the rest of them are zero. I tried using backtest data where the indicator shows green, as well as red, but the return values did not change at all.

Any help would be highly appreciated. Thank you very much for your time.
Would make a wild guess it is using buffer#3 which would be the trend buffer, which would be if trend = 1 = buy and trend =-1 = sell.

Thank you very much for responding, MrTools. :) The problem I have is that I never got the iCustom to return a value other than 2147483647.0 for Buffer#3! "The value of Indicator Buffer 3 is: 2147483647.0" is always the result I get, despite the indicator going through Buy or Sell regions. Same goes with buffer#2, whille all other buffers return 0. Am I using the iCustom right?


Re: Coding Help

#1072
Good Day mrtools
Please help look into the attached indicators code, it takes too long to calculate and load on the chart, also slow down the MT4
kindly help fix this bug
thanks.

Olayemi.
ReverseTMA(TP)+FisherRSX.mq4
(5.03 KiB) Downloaded 91 times

Re: Coding Help

#1073
OLAYEMI8 wrote:
Fri Dec 13, 2019 3:03 am
Good Day mrtools
Please help look into the attached indicators code, it takes too long to calculate and load on the chart, also slow down the MT4
kindly help fix this bug
thanks.

Olayemi.
Hi the indicator uses these indicators listed to work well, make sure you have in the index folder with the exact names.

It doesn't work well, you have to know originally if it worked well.

NonLag Inverse fisher transform of RSX
Fisher_Yur4ik_2
TMA+CG mladen
ZeroLAG_MA
Catturaii.JPG
The perfect indicatoris our head ...

Too many indicators confuse the head

Re: Coding Help

#1074
pacois wrote:
Fri Dec 13, 2019 4:18 am
OLAYEMI8 wrote:
Fri Dec 13, 2019 3:03 am
Good Day mrtools
Please help look into the attached indicators code, it takes too long to calculate and load on the chart, also slow down the MT4
kindly help fix this bug
thanks.

Olayemi.
Hi the indicator uses these indicators listed to work well, make sure you have in the index folder with the exact names.

It doesn't work well, you have to know originally if it worked well.

NonLag Inverse fisher transform of RSX
Fisher_Yur4ik_2
TMA+CG mladen
ZeroLAG_MA

Thanks for the quick response, yes i have all these indicators with their exact names in my indicator folder, and still don't why its not work properly on the chart, it takes hours to load on the chart, and sometimes its almost crash my mt4

Re: Coding Help

#1075
OLAYEMI8 wrote:
Fri Dec 13, 2019 6:52 am
pacois wrote:
Fri Dec 13, 2019 4:18 am

Hi the indicator uses these indicators listed to work well, make sure you have in the index folder with the exact names.

It doesn't work well, you have to know originally if it worked well.

NonLag Inverse fisher transform of RSX
Fisher_Yur4ik_2
TMA+CG mladen
ZeroLAG_MA

Thanks for the quick response, yes i have all these indicators with their exact names in my indicator folder, and still don't why its not work properly on the chart, it takes hours to load on the chart, and sometimes its almost crash my mt4

Yes, I have noticed, and I wonder if it has ever worked well, in fact it uses 4 indicators for the arrows, with rules that I have not studied, but I have doubts about its efficiency and stability.
The perfect indicatoris our head ...

Too many indicators confuse the head


Re: Coding Help

#1076
mrtools wrote:
Thu Apr 12, 2018 4:19 am
alpha24 wrote:
Thu Apr 12, 2018 3:42 am
Dear Mrtools ,
I tried to add NLMA in this code there is no error but can not displayed on chart.
Please correct it. if there is already awesome oscillator with all averages and prices
please give me link.(searched everywhere but can't get)
Added all the averages.
Hi Mr. Tools,
I'm loving this indicator. One question, is the slope change alert the same as the color change? I working on a strategy and I need an alert when the color changes (hoping it is the same as the slope alert). Thanks.
Awesome (arrows + alerts + mtf) 1.04.ex4
(146.39 KiB) Downloaded 71 times

Re: Coding Help

#1077
naluvs01 wrote:
Wed Jan 01, 2020 6:33 am
mrtools wrote:
Thu Apr 12, 2018 4:19 am


Added all the averages.
Hi Mr. Tools,
I'm loving this indicator. One question, is the slope change alert the same as the color change? I working on a strategy and I need an alert when the color changes (hoping it is the same as the slope alert). Thanks.
Yes.

Re: Coding Help

#1078
mrtools wrote:
Wed Jan 01, 2020 11:42 am
naluvs01 wrote:
Wed Jan 01, 2020 6:33 am


Hi Mr. Tools,
I'm loving this indicator. One question, is the slope change alert the same as the color change? I working on a strategy and I need an alert when the color changes (hoping it is the same as the slope alert). Thanks.
Yes.
Thank you Mr. Tools and Happy New Year!!!!

Re: Coding Help

#1079
Hello experts.
I received this half-trend EA from a friend but the EA has an issue with closing orders as soon as they are opened with a loss.
Someone to please have a look at the code and provide a solution. Thanks in advance.
Sly_Fox_Half-Trend_Rider.mq4
This is the Expert Advisor
(31.82 KiB) Downloaded 25 times
half-trend.mq4
The indicator needed for EA to work
(6.38 KiB) Downloaded 15 times

Re: Coding Help

#1080
Who can I add the condition " if a position is open in this pair, turn off alerts"

for example if I had this code

Code: Select all

void manageAlerts()
{
   if (alertsOn)
   {
      int whichBar = 1; if (alertsOnCurrent) whichBar = 0;
      if (trend[whichBar] != trend[whichBar+1])
      {
         if (trend[whichBar]== 1) doAlert(whichBar,"up");
         if (trend[whichBar]==-1) doAlert(whichBar,"down");
      }
   }
}
I was thinking in the lines of :


void manageAlerts()
{
if (alertsOn) && (command that tells that there is not a position open in that symbol ) = true



or


void manageAlerts()
{
if (alertsOn) && (command that tells that there is position open in that symbol ) = false


I don't know code , I know very very very little of programming, but enough to understand the logic of the code.

Thank you for your help in advance.


  1. Similar Topics

    1. Help coding simple EA

      5 Replies 713 Views

      by Griff90, Tue Nov 13, 2018 8:36 am in Coding Help

      5 Replies
      713 Views
    2. Coding help for Automatic-trendlines.mq4

      0 Replies 253 Views

      by egg, Fri Sep 13, 2019 2:11 am in Coding Help

      0 Replies
      253 Views

Return to “Coding Help”

Who is online

Users browsing this forum: CommonCrawl [Bot], mrtools and 27 guests