Errors, bugs, questions - page 284

 
alexvd:

How are the stops and TPs set?

Do you open a position first and only then modify it, or do you specify the proper SL and TP immediately?

You open a position first and then modify it...
 
Voodoo_King:

build 384. it seems i found another bug... When viewing the history, orders - the set Stop Loss and Take Profit levels are not displayed...


They are "displayed" when an order is being set. They are not displayed when a position is closed by the server using a stop, which is natural, since the server does not set stops when closing a position.
















































































































 

I've discovered something like this. I don't know if it's a bug or not, but it looks like one. The following code:

lot=NormalizeDouble(My_AccountInfo.MaxLotCheck(_Symbol,ORDER_TYPE_BUY,latest_price.ask)/10,2);
printf(lot);

Outputs in the tester log (at a deposit of $1000):

2011.01.28 20:06:48    Core 1    2010.01.04 00:56:00   0.07000000000000001

Shouldn't the function (NormalizeDouble) remove all non-zero digits after 7?

Thought I found a solution in the form: lot=floor((My_AccountInfo.MaxLotCheck(_Symbol,ORDER_TYPE_SELL,latest_price.ask)/10)*100)/100,

but I got similar results too. What to do - how critical is it in trade queries?

 

Good afternoon!

I added the Comment function to the loop's body, so it could display the percentage of the loop's execution status and a couple of other values. The simple algorithm took 5 minutes (if not more) to execute in the loop body, but it only recalculated 32000 bar values (Close,High,Low,Open). I complained that the array is dynamically increasing while the loop is running, but it's not true. After debugging the algorithm, Comment has been removed - the calculation is now performed in a godsend.

Does the Comment function really slow down execution of programs? I'm frankly surprised.

System: Windows XP, Terminal 5.00.384.

Документация по MQL5: Программы MQL5 / Выполнение программ
Документация по MQL5: Программы MQL5 / Выполнение программ
  • www.mql5.com
Программы MQL5 / Выполнение программ - Документация по MQL5
 
KffAlex:

Good afternoon!

I added the Comment function to the loop's body, so it could display the percentage of the loop's execution status and a couple of other values. The simple algorithm took 5 minutes (if not more) to execute in the loop body, but it only recalculated 32000 bar values (Close,High,Low,Open). I complained that the array is dynamically increasing while the loop is running, but it's not true. After debugging the algorithm, Comment has been removed - the calculation is now performed in a godsend.

Does the Comment function really slow down execution of programs? I'm frankly surprised.

System: Windows XP, Terminal 5.00.384.

I've noticed the same effect.
 

By running the Expert Advisor on the history using only the opening prices, the Sell positions are not opened at the opening prices, but at High, and are closed at Low.

Why does this happen?

The Expert Advisor searches for signals to open and close positions using only Open[0] prices. EventSetTimer(1) is used;

 
Valmars:

They are output when an order is placed. Not available when a position is closed by the server using a stop, which is natural because the server does not set stops when a position is closed.

What's up?) ? where do they show up when orders are placed ?

I'm talking about the "History" report, and I don't see anything in the Stop Loss and Take Profit columns, even though the positions have these values.

how do i know if a stop loss has been set or not? i mean, if it has been triggered, i can see it, but not?

 

I have the following question.

The task is to write Equity values to a specific file during the test phase, erasing the previous values.

But what happens here is the following:

1. WhenFileDelete() is absent in OnInit(), it is written in addition to existing ones.

2. But when FileDelete() in OnInit() is present, despite the same Equity records in OnCalculatde(), the resulting file turns out to be empty.

Why does this happen and how to avoid it?

Below is the code:

#property copyright "Copyright 2010, MetaQuotes Software Corp."
#property link      "http://www.mql5.com"
#property version   "1.00"
#property indicator_separate_window
#property indicator_buffers 1
#property indicator_plots   1
#property indicator_label1  "Label1"
#property indicator_type1   DRAW_LINE
#property indicator_color1  Red
#property indicator_style1  STYLE_SOLID
#property indicator_width1  1
double   Values[];
string   Array[];
string   filename="equity FileWrite25.txt";
int      handle;
int      NumberCopyElements;
string   common_folder;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit(){
   SetIndexBuffer(0,Values,INDICATOR_DATA);
   PlotIndexSetInteger(0, PLOT_DRAW_BEGIN, 100);
   PlotIndexSetDouble(0, PLOT_EMPTY_VALUE, EMPTY_VALUE);
   ArraySetAsSeries(Values, false);
   //---
   common_folder=TerminalInfoString(TERMINAL_COMMONDATA_PATH);
   FileDelete(filename,FILE_COMMON);
   return(0);
}
int OnCalculate(const int        rates_total,
                const int        prev_calculated,
                const datetime&  time[],
                const double&    open[],
                const double&    high[],
                const double&    low[],
                const double&    close[],
                const long&      tick_volume[],
                const long&      volume[],
                const int&       spread[])
{  
   uint written;
   handle=FileOpen(filename,FILE_WRITE|FILE_READ|FILE_COMMON|FILE_TXT);
   if(handle!=INVALID_HANDLE){
      FileSeek(handle,0,SEEK_END);
      written=FileWrite(handle,TimeToString(TimeCurrent())," ",AccountInfoDouble(ACCOUNT_EQUITY));//TimeToString(time[i]),
      PrintFormat("Equity FileWrite25 - OnCalculate(): Записано %d байт в общую папку всех терминалов - %s",written,common_folder);
   }
   else {
      Print("Equity FileWrite25 - OnCalculate(): Не удалось открыть файл ",filename,".  Ошибка ",GetLastError());     
   }
   FileClose(handle);
   return rates_total;
}
void OnDeinit(const int reason){
   FileClose(handle);
}
 
Voodoo_King:

what's up :) ? where are they displayed when an order is placed ?

I'm talking about the "History" report, and I don't see anything in the columns Stop Loss and Take Profit, although the positions have these values.

how do i know if a stop loss has been set or not? if it has worked, i can see it, but if not?

It is displayed in the tab 'History/Order', and what do you think the stop-loss and take-profit in the order, which the server uses to close the position when the stop is triggered, are equal to? You are looking at the exact parameters of the orders.
 
DV2010:

I have the following question.

The task is to write Equity values to a specific file during the test phase, erasing the previous values.

But what happens here is the following:

1. When FileDelete() is absent in OnInit(), it is written in addition to existing ones.

2. But when FileDelete() in OnInit() is present, despite the same Equity records in OnCalculatde(), the resulting file turns out to be empty.

Why does this happen and how to avoid it?

The code is given below:

I've invented a solution to recognize test mode, but there's some empiricism in it which embarrasses me

(I tried to find an opportunity to get the start time of the tester programmatically, to set indentation from it to the depths of history and cut off thus the real time,

but unfortunately did not find it):

   if(rates_total - prev_calculated > 1 && rates_total - prev_calculated < 10000){
    FileDelete(filename,FILE_COMMON);
   }   
But there is a problem of quite a different nature, which is that after changing the testing period the indicators according to the test results disappear for some reason, but if after that you make a compilation for a new period, then running the tester will display them.

Bug?