[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 138

 
supernyb:

but for the output, I understand that the printer only prints 4 or less digits.

then if Print (DoubleToStr(Startprice,5)); // print Startprice

it gives out 5.

But when you add a bar time

This line does not add the bar time?



string name="Pr1_";
string cur_name=name+Time[0];
 
supernyb:


if it's like this.

it's not working, it's blaming '=' - incompatible types C:\fortest\experts\sve.mq4 (34, 14)

How do I write it correctly?

Thanks for the reply, I've been working on it for a week already)


Try it like this:

 extern int MA_Period = 50;                   //периуд Ма
extern int MA_Method =MODE_SMA;               //Метод усреднения скользящего среднего. Может быть любым из значений методов скользящего среднего (Moving Average):
                              //*MODE_SMA 
                              
 extern int Maximum_History = 0;              //Ограничение истории для расчетов, если 0 то расчет всей истории
 
   
    
                                               //начало кода советника
int start()
{      
    double MA4;                                // Значение МА на 4 баре     
    double Startprice;
  
   MA4=iMA(NULL,0,MA_Period,0,MA_Method,PRICE_CLOSE,4); 
 
   
 if  (Low[4]< MA4 && MA4 < High[4])            //условия если 4-я свеча лежит в скользящей  
     {      
   Startprice=Close[0];
     }
       
   Print (DoubleToStr(Startprice,5));          // распечатаем Startprice
     
      
   datetime TmR1=Time[0];                      // запоминаем время текущего бара? 
   
       ObjectCreate("Rep1"+TmR1,OBJ_ARROW, 0, TmR1, Startprice); // создаем обьект 
       ObjectSet("Rep1", OBJPROP_COLOR, White); // устанавливаем обьект на график
       ObjectSet("Rep1", OBJPROP_ARROWCODE,71); 
      
     return(0); 
 }    
 
supernyb:

but for the output, I understand that the printer only prints 4 or less digits.

then if Print (DoubleToStr(Startprice,5)); // print Startprice

it gives out 5.

But when you add a bar time

This line does not add the bar time?


 
Roger:
Show how you got bay_min.


 if (StochM < St_min && StochS < St_min) 
   bay_min = true;
 
r772ra:
if (bay_min == true)   datetime T=Time[0] //сработал сигнал на покупку запоминаем время  бара

if(iBarShift(NULL,0,T)==2) //по времени, сигнал был на 2 баре
   {   
  if (Open[1]<Close[1] && Open[2]<Close[2] )   //и эти бары бычьи 
     { 
    // что-то делаем
     }
   }
   
// я думаю, как-то так.

Thank you, the logic is clear, but it has stopped opening a trade altogether
проблема в этой строчке
if(iBarShift(NULL,0,T)==2) //по времени, сигнал был на 2 баре
 
Please advise. My ZigZag indicator is overdrawing. It draws a certain object on the chart. When price changes and it is necessary to delete the object, the object is deleted, but value of buffer in the chart is still. How to delete old value also, not only from chart? If you can code or show where it is implemented in the zigzag?
 
Dimka-novitsek:
How do I teach the computer to perform strictly this task biz brakes? Otherwise, the speed tester lever only responds if it wants to! The delay is often 3-8 seconds. Mentioning all the bad women!
Have a nice day!
 
Dimka-novitsek:
How do I teach the computer to perform this strictly business task biz brakes? Otherwise, the speed tester lever only responds if it wants to! The delay is often 3-8 seconds. Mentioning all the bad women!


Making the best of it
 



Strategy Tester Report

subot11
(Build 438)

SymbolEURUSD (Euro vs US Dollar)
Period1 Hour (H1) 2005.01.24 00:00 - 2012.09.26 23:00 (2005.01.24 - 2012.09.27)
ModelAll ticks (most accurate method based on all smallest available timeframes)
ParametersParameters=" EA"; lot=1; lot2=1; Magic_Number=68705; yroven=120; pr=50; sp=16; MA_Period=50; Maximum_History=0;

Bars in history48438Modelled ticks62876826Simulation quality90.00%
Chart mismatch errors0




Initial deposit10000.00



Net profit7635.00Total profit41380.00Total loss-33745.00
Profitability1.23Expected payoff16.71

Absolute drawdown2271.00Maximum drawdown3769.00 (32.78%)Relative drawdown32.78% (3769.00)

Total trades457Short positions (% win)0 (0.00%)Long positions (% win)457 (24.29%)

Profitable trades (% of all)111 (24.29%)Loss trades (% of all)346 (75.71%)
Largestprofitable trade600.00losing deal-150.00
Averageprofitable deal372.79losing trade-97.53
Maximum numbercontinuous wins (profit)5 (2020.00)Continuous losses (loss)20 (-2114.00)
MaximumContinuous Profit (number of wins)2098.00 (4)Continuous loss (number of losses)-2114.00 (20)
Averagecontinuous winnings2continuous loss5




I managed to create my own EA. I ran it with a fixed spread of 19. Since 2005. Always stop loss. Take always. It does not use averaging and martin. Positions are closed within the day, i.e. are not transferred to the next day.

My programmer is lousy, to put it mildly.

 
artmedia70:

Been away for a few days... I'm wondering - do the wizards thrown over the graph have the same parameters as the wizards used in the calculations? Maybe that's where the problem lies?

Of course, they have the same parameters. Here, in test mode, I opened the properties of a given MA.

MA parameters

artmedia70:

(I still had no time to delve into the code and take it apart).

It's all written very simply, so anyone can understand it at a glance :)

artmedia70:

I would make a function, for example:

//-----------------------------------------------------------------------------+
double ma(int MAperiod, int MAmethod, int MAshift) {return (iMA(Symbol(), Period(), MAperiod, 0, MAmethod, PRICE_OPEN,MAshift));}
//-----------------------------------------------------------------------------+
and called it to get parameters


I was thinking about it initially when I wrote the whole Expert Advisor, not this one. BUT. iMA is already a function. Calling iMA function, you can enter any parameters, some with globally declared variables, and some by default, for example. The point is that what's the point of calling a function from a function if it doesn't make any sense?