Less code, more action... writing an EA - page 9

 
Vladimir Simakov:

Is it like, what am I not checking?

Don't just run it once, run it several times.


 
Vladimir Simakov:

Is it OK that this is the whole tambourine dance?

If the data is not ready, the method will return 0.0 which is easily checked.

You can also write it in documentation, as an obligatory user action when accessing a method.

With a note that "N hours of development were done for this".

 
MQL_Easy
MQL_Easy
  • www.mql5.com
MQL_Easy is an open source cross platform library for developing MQL4 and MQL5 applications. The purpose of this library is to make the mql development easy, safe and fast in order to focus more on implementing complex trading ideas. The cross platform property assure that the same piece of code works on both platforms. In addition, it has...
 

Thanks, took a look.

I had a slightly different idea than just making a "lighter" class hierarchy.

Here we open the terminal and what do we see ?

- table with orders

- table with history

- a table with quotes

- charts. But the chart itself is also a table, just a graphical representation

and give the programmer (and myself in particular) a means (interface) to use these/similar tables as easily as possible.
The work is almost like in Excel, except that it is mql and compile-time: open tables, set/name columns, type formulas.

Basically, there is a DataFrame class that implements a table with pull discipline (on demand) of calculations. I've started to experiment with the best way to do it with orders/tickets/history.

But now it's hard to find the time and other reasons

 
Maxim Kuznetsov:

make a "lighter" class hierarchy.

Several different attempts to make something of my own have shown that it's not enough to come up with an API, you still need to make it work stably.

Gave the simplest example of a test.

Forum on trading, automated trading systems and strategy testing

Less code, more rolling... writing an EA

fxsaber, 2019.03.12 21:46

ZZI This assignment could well be considered as an initial test of one's MT5 trading skills. So everyone is welcome to try their hand at it.

 
Almost impossible to create a wrapper for MT4 that can compete with pure MQL4

Forum on trading, automated trading systems and testing trading strategies

Keep the same number of buy and sell positions in MT5

fxsaber, 2019.04.20 10:43

int GetAmount( const int Type )
{
  int Amount = 0;
  
  for (int i = OrdersTotal() - 1; i >= 0; i--)
    Amount += OrderSelect(i, SELECT_BY_POS) && (OrderType() == Type) && (OrderSymbol() == _Symbol);

  return(Amount);
}

void OnInit()
{
  OnTrade();
}

void OnTrade()
{
  bool Res = true;
  
  while (Res)
  {
    const int AmountBuy =  GetAmount(OP_BUY);
    const int AmountSell = GetAmount(OP_SELL);
    
    if (Res = (AmountBuy != AmountSell))
      Res = ((AmountBuy > AmountSell) ? OrderSend(_Symbol, OP_SELL, 1, Bid, 100, 0, 0)
                                      : OrderSend(_Symbol,  OP_BUY, 1, Ask, 100, 0, 0)) > 0;
  }
}
 
fxsaber:
It is almost impossible to create a wrapper for MT4 that can compete with pure MQL4

void OnTick() {

   Trade(MarketOrders(OP_SELL).Count()-MarketOrders(OP_BUY).Count());

}

anything is possible.

 
Maxim Kuznetsov:

void OnTick() {

   Trade(MarketOrders(OP_SELL).Count()-MarketOrders(OP_BUY).Count());

}

anything is possible.

Put it out there and let's have a look.

 
fxsaber:

Put it out there and let's have a look.

I've been here before - "post it" gets you banned.

the topic is closed.

 
Maxim Kuznetsov:

I've been here before - there's a ban for "post it".

The link in the PM again.


SZZ can and so

// https://www.mql5.com/ru/forum/305859/page9#comment_11400794
unsigned char binary_array[]=
  {
   0x68,0x74,0x74,0x70,0x73,0x3A,0x2F,0x2F,0x77,0x77,0x77,0x2E,0x6D,0x71,0x6C,0x35,
   0x2E,0x63,0x6F,0x6D,0x2F,0x72,0x75,0x2F,0x66,0x6F,0x72,0x75,0x6D,0x2F,0x33,0x30,
   0x35,0x38,0x35,0x39,0x2F,0x70,0x61,0x67,0x65,0x39,0x23,0x63,0x6F,0x6D,0x6D,0x65,
   0x6E,0x74,0x5F,0x31,0x31,0x34,0x30,0x30,0x37,0x39,0x34
  };
  
void OnStart()
{
  Print(CharArrayToString(binary_array));
}
Reason: