Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 280

 
Integer:

Oh, you're getting all worked up. And I got turned on after I openly declared that I don't need these sourcebooks. I don't need them, I don't see any value in them. For you Vadimi, they are a source of great pride and nothing else. I remind you again - it's just funny how you're clinging to them... and carrying them high above your head like a banner.


Dimitri, stop arguing with Vadim. You'd better guide the seekers :) I've been struggling with libraries for a couple of days now. My question is getting farther and farther away under the pressure of these remarks...

This is not a forum for measuring penises, it's a forum for discussing issues. Which one of you is smarter is not for us to decide.

 
hoz:


Dimitri, stop arguing with Vadim. It would be better if you could guide the seekers :) I've been struggling with libraries for a couple of days now. My question is getting farther and farther away under the pressure of these remarks...

This isn't a pissing contest, it's a discussion thread. Which one of you is smarter is not for me to decide.


I've seen it. A well-worded question is half the solution. The inlude is not an import. You should try to call some function from a file that doesn't seem to be connected. What is written in the logs there may not be necessary, it is not worth paying attention to.
 
Integer:

Seen it. A well-worded question is half the solution. The inlude is not an import. You should try to call some function from the file that doesn't seem to be connected. What is written in the logs there may not have to, it is not worth paying attention to.

So, I will try to call it tomorrow. I have no debugger, so I don't know how to approach this task. No errors either. And the owl doesn't work. It won't print anything. Anyway, I'll try it tomorrow and report back.
 
novator 24.11.2013 19:37 #
Good evening, is it possible to use multiple medgies in one EA?
You can.
 

Why doesn't it work

   int handle;
   handle=FileOpen("openorder.csv",FILE_CSV|FILE_READ|FILE_WRITE,"\n");
   if(handle>0)
     {
      FileWrite(handle,open_price_order,"\n");
      FileClose(handle);
     }
 
itum:

Why doesn't it work


It seems to me that standard delimiter in CSV file is not a line feed, but comma or some other character set as a delimiter. And if you read data from CSV as strings, and somewhere in string there is a comma not as a delimiter, then the whole string must be marked with quotes.

Here's a look:

DateTime,Name,Country,Volatility,Actual,Previous,Consensus
"20131125 09:00:00", "Nationwide house price index (y/y)", "UK ", "2",""", "5.8%", "6.0%"

The first line of the file contains comma separated values. They can be read normally. The second line has all the data enclosed in inverted commas, but also has commas as delimiters. But there is line 5.8% where a comma is not a delimiter. This line must be enclosed in inverted commas. Well, the code must remove extra inverted commas at the beginning and end of the string. In doing so, we do something like this:

   DatTim=FileReadString(handle);StrTrim(DatTim);if(DatTim !="DateTime") err=1;else{
    Name=FileReadString(handle);StrTrim(Name);if(Name !="Name") err=1;else{
     Country=FileReadString(handle);StrTrim(Country);if(Country !="Country") err=1;else{
      Volatility=FileReadString(handle);StrTrim(Volatility);if(Volatility !="Volatility") err=1;else{
       Actual=FileReadString(handle);StrTrim(Actual);if(Actual !="Actual") err=1;else{
        Previous=FileReadString(handle);StrTrim(Previous);if(Previous !="Previous") err=1;else{
         Consensus=FileReadString(handle);StrTrim(Consensus);if(Consensus !="Consensus") {err=1;}}}}}}}

This is the analysis of the file header. The StrTrim(DatTim) function in my code just removes unnecessary quotes if there are them at the beginning and end of the line. After that, we just read the file and convert data from string to the needed format. But although it all depends on what you have in the CSV file. As a rule it works fine if there are strings in CSV.

See FileReadString( int handle, int length=0) and FileOpen( string filename, int mode, int delimiter=',')

 

All I want to do is write the opening price of an order to CSV. How do I do that?

 
itum:

All I want to do is write the opening price of the order into CSV. How can I do this?



That seems to be correct then.


handle=FileOpen("openorder.csv",FILE_CSV|FILE_READ|FILE_WRITE,",");

FileSeek(handle,0, SEEK_END);// This is in case you want to add to existing file.

FileWrite(handle,open_price_order);

I was reading CSV on the contrary. Do not put "\n" as a separator. It will be added after each FileWrite. Put "," or ";". And then when you open Excel, or whoever it is, will ask you to enter the delimiter. Should work, no time in the tester to check.... Because FileWrite(handle,open_price_order); will insert one line into file, but if FileWrite(handle,open_price1_order, open_price2_order ); will still be one line, but separator will be inserted between oppenprice. A subsequent call to FileWrite will result in a new line in the file.

 
Hi,
It's about MT4.
Can someone tell me how to set days in a week so that the EA trades from Monday to Friday, but less than 23 hours on Friday.

If i'm wrong it's because i've noticed some peculiarities in testing of some algorithms that affect the start date of the test.
Thanks in advance !
 
Integer:

Include is not an import.

It's understandable. I'm importing libraries. And the inline is just to insert a piece of code in some place. It saves space in the board.

Integer:

We should try to call some function from a file that doesn't seem to be connected. What is written in the logs there may not be necessary, it is not worth paying attention to.

Loaded these libraries in another scoop, everything works fine. I mean, that functions from those libraries work. But there is one point. The other scoop, I loaded these libraries directly into the scoop. And in owl, where now is not some kind of a bug arose these libraries inside 1 of the used libraries. Like this:

In sovok so in the hat:

#property copyright "hoz"
#property link      ""

#include <hoz_Base@Include.mqh>
#include <hoz_Base@ListOfFunc.mqh>
#include <hoz_MakeListOfInstruments@Include.mqh>
#include <hoz_MakeListOfInstruments@ListOfFunc.mqh>

extern string ___H1 = " ________ Параметры общие _________ ";

extern string ___H3 = " _______ Параметры фильтров _______ ";

extern string ___H4 = " __ Параметры торговых операций ___ ";
extern double  i_Lot = 0.1,
               i_KLot = 2,
               i_SL = 0,
// ДРУГИЕ ВНЕШНИЕ ПАРАМЕТРЫ ЭКСПЕРТА

So #include <hoz_Base@Include.mqh> is an inclusion of basic library (declarations of variables), and #include <hoz_Base@ListOfFunc.mqh> is already an inclusion in which imported functions of this library of this format are prescribed:

#import "hoz_Base@Library.ex4"
    void fInitBase (string fs_SymbolList, string fs_MagicList, string fs_Delimiter = ",");
    double ND (double v);
    string DToS (double v);
    double SToD (string v);
    int SToI (string v);
    datetime SToT (string v);
    double NDByMinLotPres(double v);
// ДРУГИЕ ФУНКЦИИ
    void fShiftIndex (double& ar_MAS[], bool fb_Conditions = false);
    void fSort_InDecreasingSequance (int& fia_INDEX[], double fda_Value[]);
    void fCreat_ArrayGV (string& fsa_Base[], string fsa_Add[]);
#import

The hoz_Base@Library.ex4 library itself requires 3 third-party libraries to work. These are the ones that are imported at the beginning of the base library itself:

//+---------------------------------------------------------------------------------------------------------------------------------------+
//|                                                                                                                  hoz_Base@Library.mq4 |
//|                                                                                                                                   hoz |
//|                                                                                                                                       |
//+---------------------------------------------------------------------------------------------------------------------------------------+

#property copyright "hoz"
#property link      ""
#property library

//+---------------------------------------------------------------------------------------------------------------------------------------+
//| Библиотека базовых функций.                                                                                                           |
//+---------------------------------------------------------------------------------------------------------------------------------------+
// ================================================== Включения и импорт внешних модулей =================================================+
#include <hoz_Base@Include.mqh>
//+---
#import "hoz_LoggingToAnyWere@library.ex4"
    void fWrite_Log (string fs_Txt);
    void fPrint (string fs_Text);
#import
//+---
#import "hoz_HandlingWithErrorS@library.ex4"
    bool fErrorHandling (int fi_Error, bool& fb_InvalidSTOP);
    void fReConnect();
    string fErrorToString (int fi_Error);
    string fErrorDescription (int fi_Error);
#import
//+---
#import "hoz_ReturningSomeInfo@library.ex4"
    string fGet_NameOP (int fi_Type);
    string fGet_NameTF (int fi_TF = 0);
#import

I understand that if there were a bug in any of those libraries that hoz_Base@Library.mq4 uses , the base library would not load, and consequently none of those libraries would be loaded. In fact, at the moment even the first line of startup is not working. How do I look for the cause of this situation?
Reason: