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

 

Write a simple indicator (gistograma) as an example (on a new build) on the condition Close[i]>ma[i] ->histogram above zero and Close[i]<ma[i]->histogram below zero. Then I will use it as a template for others.

ma[i]=iMa(NULL,..............) Ma has any parameters.

 
gince:

Write a simple indicator (gistograma) as an example (on a new build) on the condition Close[i]>ma[i] ->histogram above zero and Close[i]<ma[i]->histogram below zero. Then I will use it as a template for others.

ma[i]=iMa(NULL,..............) Ma has any parameters.


Open Awesome.mq4 and voila, miracle, MA is inside, the only thing left is to add Close[i]))
 
evillive:

Open Awesome.mq4 and oh, wow, MA is inside, all we have to do is Close[i]))

THANKS. That's how I am going to write
 
artmedia70:



If it's not too much trouble... Need a shift of the hourly bar extremum of a particular month, by the way look in your personal message.
 
  if(IsNewBar()==true) //если новый бар то начинаем считать
     {
      if(!ExistPositions(Symbol(),-1,111,0))//если нету откр ордеров с магиком то продолжаем...взята из ветки кима
        {

         if(GetTypeLastClosePos(Symbol(),111)!=OP_BUY)//если тип последнего закрытого ордера не покупка то розрешаем покупать .....взята тоже из ветки кима
           {
            trade=true;
           }

        }
      if(trade==true)
        {
         OpenPosition(Symbol(),OP_BUY,0.1,Ask-sl*Point,Ask+tp*Point,111);
        }

     

   if(!ExistPositions(Symbol(),-1,111,0))//аналогично///только если тип последнего ордера закрытого не продажа то можем продавать
     {

      if(GetTypeLastClosePos(Symbol(),111)!=OP_SELL)
        {
         trade2=true;
        }

      if(trade2==true)
        {
         OpenPosition(Symbol(),OP_SELL,0.1,Bid+sl*Point,Bid-tp*Point,111);
      }
  }
 }
so we get a system that should open buy and sell orders one by one...... but somehow it does not open one by one and bombs only buys
 
Zver4991:
thus, we obtain a system that should open buy and sell orders one by one...... but somehow it does not open one by one and bombs only buys

Assigning

trade=false;
trade2=false;

to everything that's written there.

 
evillive:

Assigning

to everything that's written there


thanks ...remembered at this very moment what i wrote....the problem i have is that i cannot open a trade when the MA is crossed only once.....a i have multiple openings of the same type
 
Nesradamus:

If you don't mind me asking... Need a shift of the hourly bar extremum of a particular month, by the way look in your personal.

I looked it up. Thank you.

But there's not much information in the question. A month has a lot of extrema on the hour bars. And by the way, extremum of what exactly?

 

Hello!

Can you tell me how to make a condition -

if there is enough free margin to open a position?

(So that error 131 doesn't pop up)...Thanks!

 
niktron:

Hello!

Can you tell me how to make a condition -

if there is enough free margin to open a position?

(So that error 131 doesn't pop up)...Thanks!

You need to check the permissible position volume, not the margin. The 131st error indicates an incorrect lot
Reason: