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

 
alsu:
Of the proprietary ones, probably MS VisualStudio, there are also free ones, CodeBlocks, for example, is quite good.
Thanks, I think I will start with VISUAL C++ 2010 EXPRESS and CodeBlocks.
 
rustein:

Decided to start learning C,C++,C#, who can suggest a good compiler and editor.

Thank you.


FORGOTTEN

PERL

 
freeDRIVER:


NOTHING ELSE IS FORGOTTEN.

PERL

Thanks, read it, interesting project.
 

Unfortunately none of the above has helped.

The question https://www.mql5.com/ru/forum/138609/page9#edit_form is still relevant.

Please help!

 

Need an indicator that shows the smallest bar or candle, for a certain period. for example, on the 4H chart will show the smallest candle or bar for 5 days.

Days or hours, to be set in the settings of the indicator. And marked this candle arrow as in the indicator Fractals.

Or something like that.
 
Fox_RM:

Unfortunately none of the above has helped.

The question https://www.mql5.com/ru/forum/138609/page9#edit_form is still relevant.

Please help!

Please show me the code again with the changes you made
 
Fox_RM:

Unfortunately none of the above has helped.

The question https://www.mql5.com/ru/forum/138609/page9#edit_form is still relevant.

Please help!

You have already received a lot of advice. Firstly, it's not correct for the question to again post the original code (without your comments, or rather corrections). Secondly, you must work out your own algorithm of error retrieval. No one has worked out better (within MQL4), than to print intermediate results. The Author can see the logical errors first of all, since he is the ONLY one who knows the logic of the code he wrote... ;)))
 

Latest version:

//+------------------------------------------------------------------+
//|                                              Ti&Pi_Exp.mq4       |
//|                                        Copyright © 2012, FOX.RM  |
//|                                             fox.rm@mail.ru       |
//+------------------------------------------------------------------+

#property copyright "Copyright © 2012, FOX.RM"
#property link      "fox.rm@mail.ru"

int start() {  
 
double MA1[],MA2[];
double delta,price,old_price,col_bar,sum_tick,sum_pip,TP_UP[20],TP_DN[20],TP_UPMin[20],TP_DNPl[20]; //---размерность массивов
int sum_pip_bay,sum_pip_sell,i=0,limit,k=0,old_sell=0,old_bay=0;
int count_plus,count_minus,raz,count;
datetime time_Bar; 

  ArrayResize(MA1,Bars);ArrayResize(MA2,Bars);

raz=20-Bars;                    //--- расчет по
count=Bars+raz;                 //--- последним 20 барам
for (i=0;i<count;i++)           //--- вроде так
{  
    price = Close[i]/Point;    
    delta = price-old_price;
          
    if(!time_Bar)time_Bar=Time[0];
    col_bar = iBarShift(NULL,0,time_Bar)-iBarShift(NULL,0,Time[i]);
    if (col_bar >= 1)
    
    {time_Bar=Time[i];sum_pip_bay=0;
    sum_pip_sell=0;sum_pip=0;
    old_bay=0;old_sell=0;sum_tick=0;
    count_plus=0;count_minus=0;}
     
     //---- Расчет UP
    if(delta>=0)
    {if(delta>100)delta=1;
    sum_pip_bay = delta + old_bay;   
    old_bay=sum_pip_bay;
    count_plus++;}  
    
     //---- Расчет Down
    if(delta<0)
    { sum_pip_sell = delta+old_sell;
     old_sell=sum_pip_sell;
    count_minus++;}
          
        sum_tick=count_plus+count_minus;
        sum_pip=sum_pip_bay+MathAbs(sum_pip_sell);
     
      //---
  
        if (MA1[i]>=0){TP_UP[i]=MA1[i];}else{TP_UPMin[i]=MA1[i];}
        if (MA2[i]<=0){TP_DN[i]=MA2[i];}else{TP_DNPl[i]=MA2[i];} 
             
//----
    old_price=price; 

//------
if(NewBar())
  { 
  
 MA1[i] = count_plus - sum_pip_bay;
 MA2[i] = count_minus - MathAbs(sum_pip_sell);
 
 //---- Условия на открытие сделки
 
 
 if (Sredn(TP_UP)>=1.5)OrderSend(Symbol(),OP_SELL,0.1,Bid,2,50,20);  //--- сделки только + Bid
 if (Sredn(TP_DN)>=1.5)OrderSend(Symbol(),OP_BUY,0.1,Ask,2,50,20);  //--- на новом баре + Ask
   }    
   }                
   return(0);
}

//---- Функции
double Sredn(double ArrSr[])
{
double a=1,c,step=1/20;
for (int i=0;i<20;i++)                         //--- тут привел в соответствие
{if (ArrSr[i]==0){a*=1;}else{a*=MathAbs(ArrSr[i]);}}
c=MathPow(a, step);
  return(c);
}
//-------------
bool NewBar()
{
   static datetime lastbar = 0;
   datetime curbar = Time[0];
   if(lastbar!=curbar)
   {
      lastbar=curbar;
      return (true);
   }
   else
   {
      return(false);
   }
}
 
Fox_RM:

Latest version:

double a=1,c,step=1/20;

1) the step variable is zero. Either enter 0.05 or divide it as 1./20

2) after that, trades start trying to open, but

OrderSend(Symbol(),OP_SELL,0.1,Bid,2,50,20)

instead of 50 and 20 you should set stop loss and take profit levels (_absolute_)


P.S. I have only looked at the basic moments of non-opening. Of course, many things must be optimized and added.

 
Fox_RM:

The latest version:

What's this "mazahism" about:

raz=20-Bars;                    //--- расчет по
count=Bars+raz;                 //--- последним 20 барам

Why not just honestly declare that:

count = 20;

And not torture these arrays MA1[] and MA2[] by declaring their dimensions at once:

double MA1[20],MA2[20];

And with that:

 if (Sredn(TP_UP)>=1.5)OrderSend(Symbol(),OP_SELL,0.1,Bid,2,50,20);  //--- сделки только + Bid
 if (Sredn(TP_DN)>=1.5)OrderSend(Symbol(),OP_BUY,0.1,Ask,2,50,20);  //--- на новом баре + Ask

You need to go back to the roots of... of knowledge. You pass the size of STOPPs in pips to the trade order, and you need to pass the LEVELS!!! And to work on-line it is necessary to NORMALIZE the LEVELS (price, SL and TP)!!!

 if (Sredn(TP_UP)>=1.5)
OrderSend(Symbol(),OP_SELL,0.1,NormalizeDouble (Bid,Digits),2,NormalizeDouble (Ask+50*Point, Digits),NormalizeDouble(Ask-20*Point,Digits), 0, MAGIC);  //--- сделки только + Bid
 if (Sredn(TP_DN)>=1.5)
OrderSend(Symbol(),OP_BUY,0.1,NormalizeDouble(Ask,Digits),2,NormalizeDouble(Bid-50*Point,Digits),NormalizeDouble(Bid+20*Point,Digits), 0, MAGIC);  //--- на новом баре + Ask

And one more thing: accustom yourself from the beginning as a "grown-up" - assign your orders MAGIC!!! You'll need it in the future!!!