[ARCHIVE]Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Can't go anywhere without you - 5. - page 24

 
WindSW:

Via Print

Try this design

double xDelH[1][1];
double HBar[1][1];

int countDH=0;
HBar[countH][0]=1.23456;

xDelH[countDH][0]=HBar[countH][0];

Print("HBar=",DoubleToStr(HBar[countH][0],3),"  xDelH=",DoubleToStr(xDelH[countDH][0],4));
// распечатается: HBar=1.234  xDelH=1.2345

See how it works for you.

 
Dimka-novitsek:
Yes, thank you!!! I was the one who came straight from the street to the computer and got something completely confused!

Dimitri! A couple of tips for you. First the code (try to catch the difference):

//---- Константы
#define MAGIC 450
//---- Внешние переменные советника
extern int StopLoss   = 25;
extern int TakeProfit = 30;
//---- Глобальные переменные
double gd_TP, gd_SL;
int init()
{
    gd_TP = TakeProfit * Point;
    gd_SL = StopLoss * Point;
}
//---- Здесь какая-то пользовательская функция или start()
    if (Svetsja_1) if (!Svetsja_2) if (!Svetsja_3) if (!Orderbuy)
    {
        //стоп лосс 25 п. профит 30 п;стоп лосс 25 п. тралится по MA 20    
        double ld_TP, ld_SL;
        RefreshRates();
        if (TakeProfit != 0.0) ld_TP = NormalizeDouble (Bid + gd_TP);
        if (StopLoss != 0.0) ld_SL = NormalizeDouble (Bid - gd_SL);
        int li_Ticket = OrderSend (Symbol(), OP_BUY, lot, NormalizeDouble (Ask, Digits), 5, ld_SL, ld_TP, NULL, MAGIC, 0, CLR_NONE);
        if (li_Ticket > 0)
        {  
            Sleep (2000); RefreshRates(); 
            li_Ticket = OrderSend (Symbol(), OP_BUY, lot, NormalizeDouble (Ask, Digits), 5, ld_SL, ld_TP, NULL, MAGIC, 0, CLR_NONE);
            if (li_Ticket > 0) Orderbuy = 1;
            else
            {
                Error = GetLastError();
                string errorcomment = "Ошибка открытия ордера OP_BUY" + " " + Symbol() + " " + ErrorDescript (Error); 
                Print (errorcomment);
            }
        }
    }

What did you notice differently? - List it, and I'll then formulate advice (if you're interested, of course). ;)

 
Thanks so much!!!!!!! I refreshed the page and saw it. My brother will be here soon, I'll report back later.
 
Please advise what is the error of the GBPUSD,H1: zero divide
 
Frostr:
Please advise what is the error of the GBPUSD,H1: zero divide


Division by zero.
 
Frostr:
Please advise what is the error of the GBPUSD,H1: zero divide


Especially if in the tester you are trying to use values from other charts. For example, if you test the Expert Advisor on EURUSD, but you try to take indicator data from some other chart...
 

I don't understand what's wrong - this has never happened before. I call iCustom() for indicator readings and as a result my Expert Advisor writes that it cannot open the indicator file.

Here's the code I used, which always worked:

#property show_inputs
// ------------- Пользовательские переменные ------------------------
extern string   с1=" -------- Rad Has -------------";
extern string   IndiRadHas_Name="Rad_Has";
extern int                      MaMetod  = 2;
extern int                      MaPeriod = 6;
extern int                      MaMetod2  = 3;
extern int                      MaPeriod2 = 2;

//+------------------------------------------------------------------+
//| script program start function                                    |
//+------------------------------------------------------------------+
int start(){
  // -------------- Пользовательские переменные -------------------
        string  SMB=Symbol();

        Alert("======================================");
        // --------------- инициализируем значения индикатора RadHas -----------------------------------
                double RadHas_0_1=iCustom(SMB,0,IndiRadHas_Name,MaMetod,MaPeriod,MaMetod2,MaPeriod2,0,1);
                double RadHas_1_1=iCustom(SMB,0,IndiRadHas_Name,MaMetod,MaPeriod,MaMetod2,MaPeriod2,1,1);
                double RadHas_2_1=iCustom(SMB,0,IndiRadHas_Name,MaMetod,MaPeriod,MaMetod2,MaPeriod2,2,1);
                double RadHas_3_1=iCustom(SMB,0,IndiRadHas_Name,MaMetod,MaPeriod,MaMetod2,MaPeriod2,3,1);
                //RadHas_0_1=NormalizeDouble(RadHas_0_1,Digits);
                //RadHas_1_1=NormalizeDouble(RadHas_1_1,Digits);
                //RadHas_2_1=NormalizeDouble(RadHas_2_1,Digits);
                //RadHas_3_1=NormalizeDouble(RadHas_3_1,Digits);
        Alert("RadHas_0_1 = ",RadHas_0_1);
        Alert("RadHas_1_1 = ",RadHas_1_1);
        Alert("RadHas_2_1 = ",RadHas_2_1);
        Alert("RadHas_3_1 = ",RadHas_3_1);
        Alert("============== Скрипт 0 на паре ",SMB," ==============");
return(0);

}
//+------------------------------------------------------------------+
The indicator is attached to the post. Why do you think the indicator file won't open?
Files:
rads_has.mq4  6 kb
 
I forgot to tell you, the build of the terminal is 445
 
drknn:
I forgot to tell you, the build of the terminal is 445

Are calls to external experts allowed in the settings?
 
rigonich:

Are calls of external experts allowed in settings?

I've been programming for forex for seven years now. I would hardly have missed such a gross error. You try to call the indicator readings with this script in your terminal.

The thing is that a year ago I called this particular indicator with a script and everything was fine. I called it the same way I do now.