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

 
trader781:

Okay, so we wrote the required settings into the file, closed it, and what?

In theory, it should now re-open the EA with the required parameters, and how can a text file do this (I do not see another file in the list of functions, although in this case, you need an exe)

When you run the EA in the inite, you load the file and read the settings from it and that's it, here is a small example.

void LoadParametres()
  {
   Print("*******************************************");
   Print("Start downloading data Magic = ",Magic," ",_Symbol);
   Print("*******************************************");
   int handle=FileOpen("Overturn_"+(string)Magic+"_"+_Symbol+".csv",FILE_CSV|FILE_READ);
   if(handle>0)
     {

      tiket=(int)FileReadNumber(handle);
      flag_series=FileReadBool(handle);
      TP = FileReadNumber(handle);
      SL = FileReadNumber(handle);
      series=(int)FileReadNumber(handle);
      Lots=FileReadNumber(handle);

      FileClose(handle);
      Print("*******************************************");
      Print("Loading data completed Magic = ",Magic," ",_Symbol);
      Print("*******************************************");
     }
  }


See

 

Good day to all!

I have "Auto-Trade" button in my terminal - I placed an Expert Advisor in my window - my "alerts" started (in "Experts" tab) - I pressed "Auto-Trade" button (enabled) - created "alerts" (fine) - pressed the "AutoTrade" button (switch trading OFF) - still I get "alerts".

The question - is this the case for everyone?

If so, is it possible to set / write that "alerts" go only after pressing this button?

Maybe the question without the tower but would still be grateful for an answer!

 
Roni Iron:

Good Day to All!

I have "Auto-Trade" button in my terminal - I placed an Expert Advisor in my window - it generated "alerts" (in "Experts" tab) - I pressed the "Auto-Trade" button (I enabled it) - I pressed the "Auto-Control" button (I enabled it) - it works fine. (enabled) - created "alerts" (fine) - pressed the "AutoTrade" button (switch trading OFF) - still I get "alerts".

The question - is this the case for everyone?

If so, is it possible to set/spell so that "alerts" would only go after pressing this button?

It may be a no-brainer question, but I'd still be grateful for an answer!

The "Auto-Trading" button allows and disallows trading operations,

If you disable it, the Expert Advisors and scripts will work

 
Roni Iron:

Good Day to All!

I have "Auto-Trade" button in my terminal - I placed an Expert Advisor in my window - my "alerts" started (in "Experts" tab) - I pressed "Auto-Trade" button (enabled) - created "alerts" (fine) - pressed the "AutoTrade" button (switch trading OFF) - still I get "alerts".

The question - is this the case for everyone?

If so, is it possible to set/spell so that "alerts" would only go after pressing this button?

Maybe the question is without the tower but would still be grateful for an answer!

WatchTerminalInfoInteger(TERMINAL_TRADE_ALLOWED).
 
Roni Iron:

Good day to all!

I have "Auto-Trade" button in my terminal - I placed an Expert Advisor in my window - it generated "alerts" (in "Experts" tab) - I pressed the "Auto-Trade" button (I enabled it) - I pressed the "Auto-Control" button (I enabled it) - it works fine. (enabled) - created "alerts" (fine) - pressed the "AutoTrade" button (switch trading OFF) - still I get "alerts".

The question - is this the case for everyone?

If so, is it possible to set / prescribe that "alerts" are only sent after pressing this button?

Maybe the question is without the tower but would still be grateful for an answer!

It is possible if you have an Expert Advisor (or script) at your disposal in terms of taking and fixing the source code. You need to put a condition on all the alerts to check if the button is pressed. If the button is not pressed, do not call the alerts.
 

I made a bet on EURUSD for example 0.10, Take Profit after 100 pips, closed with 10.00 profit, now USDJPY has 7.80 profit after 100 pips.

I tried to calculate the value of one pip MarketInfo(Symbol(), MODE_POINT); I get 0,001, where am I being obtuse?

I tried to calculate my minimum lot at 100 pips to get 10.00 instead of 7.8.
 
Evgeniy Oshurkevich:

I made a bet on EURUSD for example 0.10, Take Profit after 100 pips, closed with 10.00 profit, now USDJPY has 7.80 profit after 100 pips.

I tried to calculate the value of one pip MarketInfo(Symbol(), MODE_POINT); I get 0.001, where am I stupid here?

I tried to calculate my minimum lot at 100 points to get 10.00, not 7.8.
MODE_TICKVALUE - price in the deposit currency of one pip (which is through MODE_POINT) per 1 lot
 
Maxim Kuznetsov:
MODE_TICKVALUE - price in the deposit currency of one pip (which is through MODE_POINT) per 1 lot
Ok, thanks )
 

I need to write data to an hst file, so that I can use the data to build an autonomous graph.

I've been struggling for the second day, but nothing works.

Code:

#property copyright "Copyright 2016, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property strict
ulong    last_fpos=0;         //
int      HandleHistory=-1;
//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
   string symbol=Symbol();
   int per=Period()*9;

   ResetLastError();
   if(CreateHeader()==true)//если создали заголовок
     {
      HandleHistory=FileOpenHistory(symbol+(string)per+".hst",FILE_BIN|FILE_WRITE|FILE_SHARE_WRITE|FILE_SHARE_READ|FILE_ANSI);
      if(HandleHistory!=INVALID_HANDLE)
        {

         for(int i=199;i>0;i--)//заполняем данными
           {
            MqlRates r;
            r.time=Time[i];//просто пытаюсь записать, это так для примера
            r.open=Open[i];//просто пытаюсь записать, это так для примера
            r.low=Low[i];
            r.high=High[i];
            r.close=Close[i];
            r.tick_volume=(long)10;
            r.spread=0;
            r.real_volume=(long)10;
            uint byteswritten=FileWriteStruct(HandleHistory,r);
            Print("FileOpen OK ",byteswritten," ",Time[i]);
           }
       FileClose(HandleHistory);
       // FileFlush(HandleHistory);
        }
      else Print("Операция FileOpen неудачна, ошибка ",GetLastError());
     }
// long id=ChartOpen(symbol,per);
//Alert(id);
  }
//+------------------------------------------------------------------+
bool CreateHeader()//создаем файл с историей hst(заголовок)
  {

   int      file_version=401;
   string   c_copyright;
   string   c_symbol=Symbol();
   int i_period=Period()*9;
   int      i_digits=Digits;
   int      i_unused[13];
//---  
   ResetLastError();
   HandleHistory=FileOpenHistory(c_symbol+(string)i_period+".hst",FILE_BIN|FILE_WRITE|FILE_SHARE_WRITE|FILE_SHARE_READ|FILE_ANSI);
   if(HandleHistory<0)
     {
      Print("Error open ",c_symbol+(string)i_period,".hst file ",GetLastError());
      return(false);
     }
   c_copyright="(C)opyright 2003, MetaQuotes Software Corp.";
   ArrayInitialize(i_unused,0);
//--- write history file header
   FileWriteInteger(HandleHistory,file_version,LONG_VALUE);
   FileWriteString(HandleHistory,c_copyright,64);
   FileWriteString(HandleHistory,c_symbol,12);
   FileWriteInteger(HandleHistory,i_period,LONG_VALUE);
   FileWriteInteger(HandleHistory,i_digits,LONG_VALUE);
   FileWriteInteger(HandleHistory,0,LONG_VALUE);
   FileWriteInteger(HandleHistory,0,LONG_VALUE);
   FileWriteArray(HandleHistory,i_unused,0,13);
   return(true);
  }

As a result of execution a file with history is created, but autonomous graph is not created.

Here's the info on the graph

For some reason, the data is from 2003!

As a result, I get an error when I launch the chart HistoryBase: 196 errors in 'NZDCHF45'.

I understand that I wrote something wrong. I don't know how to correctly write it, I have too little information. Who knows - please advise.


 
Vladimir:
There is a possibility, if the EA (or script) is at your disposal from the point of view of taking and correcting the source code. You need to put a condition around all alerts checking if the button is pressed. If the button is not pressed, do not call the alerts.

ThanksVladimir - I think I will either use your method or put the entire EA in this condition.

Thanks to Vitalie Postolache- I will study your recommendation. I have not studied mql5 yet.

Reason: