FOREX - Trends, forecasts and implications 2016 - page 722

 
Vladimir Zubov:

1. how do i make a new candlestick control so that one iteration is at the first tick ?

I seem to have this code working to control triggering on the opening of a candle :(

2. Why not, it's about Kim's function to determine the bar of an open position ?

P / S Turned MT4 now all over again write ...

1.

if(iTime(Symbol(),PERIOD_H1,0)==prevTime) return(0);

datetime prevTime=iTime(Symbol(),PERIOD_H1,0);

Further your code

And that's it....

//This is for H1

Ah yes, the bar is looking there. Well, it'll work then.

And after int ticket=OrderSelect() - do you have an analysis - has the order opened or not? if(ticket<0)GetLastError() - is it?

 
new-rena:

1.

if(iTime(Symbol(),PERIOD_H1,0)==prevTime) return(0);

prevTime=iTime(Symbol(),PERIOD_H1,0);

Further your code

And that's it....

//This is for H1

Yep ... You need to combine something, I take it you don't use void OnTick(), I mean 2014 syntax ?
 
Vladimir Zubov:
Yeah ... I think you're not using void OnTick(), I mean 2014 syntax ?
yeah
 
new-rena:
yeah

Or you can substitute your own version, a more correct one, I have problems with compiling, I think you have brackets in Return, but I don't know ?

 
//+------------------------------------------------------------------+
//|                                                       Privet.mq4 |
//|                        Copyright 2016, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2016, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property strict
// ============= Переменные ==========================================
int      prev_time = 0;     // Работа по ценам открытия свечи
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//---
   
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//---
   
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {//-Start-

// ======= Работа по ценам открытия свечи ============================
  if ( Time[0] <= prev_time ) {return;}
  prev_time = (int)Time[0];

// ========================== My EA ==================================
{


}  

// ========================== EA END =================================

  }//-Start End-

// ================= Функции =========================================  
//+------------------------------------------------------------------+
Это MT4
 
0
Vladimir Zubov:

Without the parentheses, it kind of frowned upon compilation before. Why "<="? On the contrary, when equals "==" we kick it back. That is, if the current bar, we wait until the time becomes different. And the time is int, it should be datetime, right?

int init()   { //---    //---    return(0);   } //+------------------------------------------------------------------+ //| Expert deinitialization function                                 | //+------------------------------------------------------------------+ int deinit()   { //---    return(0);   } //+------------------------------------------------------------------+ //| Expert tick function                                             | //+------------------------------------------------------------------+ int start()

{

return(0);

}

 
new-rena:
0

Without the parentheses, it kind of frowned upon compilation before. Why "<="? On the contrary, when equal (==) we kick it back. That is, if current bar, we wait until time becomes different. And the time is int, I think it was always datetime?

I did not go into details, somewhere here took some textbook or article, but it was in 2012 or earlier, maybe now is different, that's why it glitches sometimes in real time.

P.S. The product is crude for the market, I'll withdraw from approval, a strange problem has not noticed before.

It turns out after iteration I have not come out in Return and can work again ?

 
Vladimir Zubov:
I did not go into details, somewhere here is taken from a textbook or article, but it was in 2012 or earlier, maybe now is different, that's why it glitches sometimes in real life.

All right, so...

Why can't it work? Run it in visual mode in the tester - these things will pop out and you'll fix it once. The next one won't be such a nuisance.

It wouldn't hurt to polish the demo afterwards either.

 
new-rena:
All right, so...
Well for me for the market, and that's how I always block the candle. What if people ask why it opened twice and I don't know myself? That's not good...)
 
new-rena:

All right, so...

Why can't it work? Run it in visual mode in the tester - these things will pop out and you'll fix it once. The next one won't be so funny.

In the tester as always all is fine and took a year ago with this code too, but I myself am perplexed why it opened twice, and if 100 times ?
Reason: