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

 
MQL414:

Afternoon! "double x;" code that would remember the variable "x" after the terminal is reloaded. Thank you.

double x=10;
GlobalVariableSet("x",x);

read after reboot

x = GlobalVariableGet("x");
 

Hello, I would like to ask if I can trust this broker? I just like the quality of the quotes provided and the spread is negligible.

I WOULD LIKE TO ASK IF I CAN TRUST THIS BROKER. https://lh-broker.ru/?utm_source=babyforex&utm_medium=banner240400&utm_campaign=pervyi_bezdepositnyi

I do not know where to put this kind of message and I don't see the point in creating a new topic.

I do not want to go to the sauna, for obvious reasons.

 
MQL414:

if (((Ask>=OrderTakeProfit()) && (OrderType() == OP_BUY)) {x=1;}

if((Bid<=OrderTakeProfit()) && (OrderType() == OP_SELL)) {y=1;}

if(Hour()==00:00) {x=0;y=0;}

Add BUY x=0; SELL y=0;



Thank you very much. Seems to be just the right thing.
 

Help) What is the bug in the code) in the tester all is fine) and in the demo all is dead) no one position does not open) and no errors) not how many days like this) here is the code)

extern inttern Tenkan=5;
extern int dd=9;
extern int int slowing=3;
extern int kk=9;
extern inttern UrovenUp=56;
extern double TakeProfit=100;
extern double Lots=3;
extern double StopLoss=100;

int start()
{double MY,priceBuy,priceBuy2,Ich,D,K,K1;
double Cc1,C2,C3,C4;
int ticket;


MY=(Open[0] + Close[0] )/2;
Ich=((Open[iHighest(NULL, 0, MODE_OPEN, Tenkan)]) +
(Close[iLowest(NULL, 0, MODE_CLOSE, Tenkan)]))/2;

D=(iStochastic(NULL,0,kk,dd,slowing,MODE_SMA,0,MODE_SIGNAL,0))
K=(iStochastic(NULL,0,kk,dd,slowing,MODE_SMA,0,MODE_MAIN,0))
K1=(iStochastic(NULL,0,kk,dd,slowing,MODE_SMA,0,MODE_MAIN,1))
Cc1=Close[2] < Close[1];
C2=Close[0] > Close[1];
C3=K>K1;
C4=D<UrovenUp;


//Buy and sell price condition//
priceBuy=MarketInfo(Symbol(),MODE_ASK);
priceBuy2=MarketInfo(Symbol(),MODE_BID);


//condition to buy//


{if (MY > Ich && Cc1 && C2 && C3 && C4)

//ticket=OrderS³; //ticket=OrderS³; //condition for buying and selling//
{ticket=OrderSend(Symbol(),OP_BUY,Lots,priceBuy,3,priceBuy2-StopLoss*Point,priceBuy2+TakeProfit*Point,
"My baby",123453,0,Green);
if(ticket>0)
{
if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES))
Print("BUY order opened : ",OrderOpenPrice());
}
else Print("Error opening BUY order : ",GetLastError());
return(0);
}

}

}
 

I'm trying to figure out the iCustom() function.

I wrote a signal indicator that analyses the crossing of two MAs and gives a signal 1 or 2 - buy or sell. Here is its code:

#property indicator_chart_window

extern int MA_Light=13;
extern int MA_Hard=89;

bool sig;
int Signal=-1;
double MA_L1, MA_H1, 
       MA_L2, MA_H2;


int init()
 {
   sig=true;
 }

int start()
  {
   int    counted_bars=IndicatorCounted();
   
   MA_L1=iMA(Symbol(),0,MA_Light,0,MODE_EMA,PRICE_CLOSE,1);
   MA_H1=iMA(Symbol(),0,MA_Hard,0,MODE_EMA,PRICE_CLOSE,1);
   MA_L2=iMA(Symbol(),0,MA_Light,0,MODE_EMA,PRICE_CLOSE,2);
   MA_H2=iMA(Symbol(),0,MA_Hard,0,MODE_EMA,PRICE_CLOSE,2);
   //----------------------------------------------------------------

    if(MA_L2<=MA_H2 && MA_L1>MA_H1 && sig==true)
     {
      Signal=1;
      Alert("Покупай!!! ", Signal);
      sig=false;
     }
    if(MA_L2>=MA_H2 && MA_L1<MA_H1 && sig==true)
     {
      Signal=2;
      Alert("Продавай!!! ", Signal);
      sig=false;
     }
   
   if((MA_L2<MA_H2 && MA_L1<MA_H1 && sig==false) || // чтобы сигналило один раз
      (MA_L2>MA_H2 && MA_L1>MA_H1 && sig==false))
      sig=true;  
   
   Signal=-1;
   return(0);
  }

I tried to write an Expert Advisor that trades by these signals using iCustom, but it does not work. Sig gives me a value of 0.

extern double Lots=0.1;

double Sig;
string Symb;
bool Ans;

int init()
  {
   Symb=Symbol();

   return(0);
  }

int deinit()
  {

   return(0);
  }
int start()
  {
   Sig=iCustom(Symb,0,"experiment_iCustom_indicator",13,89,0,0);
   
   if(Sig==1)
    {
      Alert("Попытка открыть Buy...");
      Ans=OrderSend(Symb,OP_BUY,Lots,Ask,3,0,0,"",69,0);
       if(Ans==true)
        Alert("Ордер buy открыт");
       if(Ans==false)
        Alert("Произошла ошибка", GetLastError()); 
    }
   if(Sig==2)
    {
      Alert("Попытка открыть sell...");
      Ans=OrderSend(Symb,OP_SELL,Lots,Bid,3,0,0,"",69,0);
       if(Ans==true)
        Alert("Ордер sell открыт");
       if(Ans==false)
        Alert("Произошла ошибка", GetLastError()); 
    }
   
   return(0);
  }

Please explain what I did wrong and what should be done correctly.

Thank you.

 
silhouette:

I'm trying to figure out the iCustom() function.

I wrote a signal indicator that analyses the crossing of two MAs and gives a signal 1 or 2 - buy or sell. Here is its code:

I tried to write an Expert Advisor that trades by these signals using iCustom, but it does not work. Sig gives me a value of 0.

Please explain what I did wrong and what should be done correctly.

Thank you.

First, read more details about iCustom(). It works only with indicator buffers.

There are no buffers in your signal indicator (0), therefore, you cannot pull data from it. How can iCustom() know that you need a simple int variable from the indicator?

 
Hello! Please help how to find among the many open orders, the order that was opened before the new order. What is the code?
 
alsu:

reading after a reboot



Thank you! Sorted it out.

 

OrderCloseBy.

Who can explain why this situation occurs.

The top order which is a blue line Buy - 0.01
The second order the bottom Sell - 0.02
At a point where ordersCloseBy() Yellow arrow on the chart was called. On the first order it was -3 on the second +4.
After the function has been called, I expect the first one to be closed at 0 and the second one to be +1.
But it turns out that

The first order closed in 0 - line 6. And the second order closed at -1.10
Where did this -1.10 come from? Because I closed the whole minus as the total profit of two orders in +. In +1 in the example!

 
How can I hide the work of EA from brokerage companies? Let's say I don't have comments on deals, but EA writes all predefined data in the journal of MT4 EA (I understand on server of brokerage companies as well).But it turns out that the Expert Advisor is a trading one, rather than just drawing something on the chart. 2012.06.14 20:30:36 MouseTrade 1.6.1 EURUSDm,M1 inputs: use_timer=true; delete_on_deinit=true; default_sl_level=90; default_trailing_stop=0; default_tp_level=200;use_be=true; default_be_level=50; be_offset=10;use_cl=false; default_cl_level=100; use_cp=false; cp_size_or_percent=false; cp_levels="50,100,150"; cp_lots="10,50,50"; How can I disable the logging, the maximum I can write there is "expert....: loaded successfully " I do not understand or it is not provided at all?