!!! Helping for free by coding of simple mql4(5) task. - page 2

To add comments, please log in or register
eevviill7
19714
eevviill7  
amando 2016.07.18 20:23     RU

Hello, i try to get out the pips of the closed trades, i had the idea, to count the difference between order openprice and orderclose preise

void OnTick()
  {
   double Profit;
// retrieving info from trade history 


   for(i=0;i<OrdersHistoryTotal();i++)
     {
        if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY))
        {
        if(OrderSymbol() ==_Symbol)
         {
         if (OrderType() == OP_BUY ) Profit +=OrderClosePrice()-OrderOpenPrice();
         if (OrderType() == OP_SELL) Profit +=OrderOpenPrice()-OrderClosePrice();
         }
        }
      }

Print(Profit/Point);

  }
eevviill7
19714
eevviill7  

 sheriffonline 2016.07.18 07:39

I want to run my ea on following times: 

00:15 to 20:30

https://www.mql5.com/ru/code/14244

Функция работы программы по времени
Функция работы программы по времени
  • votes: 23
  • 2015.11.23
  • Vasyl Nosal
  • www.mql5.com
Функция разрешает исполнение определенного кода в указанный промежуток времени.
eevviill7
19714
eevviill7  
Brt88 2016.07.18 12:35

Hi.

I would like to add to my open conditions sth like that:

OrderOpenTime()  of last trade + 4 Hours <= TimeCurrent()

plz help

datetime ord_time=Select_last_order_f();
if(ord_time!=0 && ord_time + 4*60*60 <= TimeCurrent())

////////////////////////////if no pendings
datetime Select_last_order_f()
{
datetime ord_time=0;

 for (int i=OrdersTotal()-1; i>=0; i--)
 {
   if(OrderSelect(i, SELECT_BY_POS))
   {
   if(OrderMagicNumber()==Magic)
   { 
   if(OrderSymbol()==Symbol())
   {        
   return(OrderOpenTime());
   } 
   }             
   }
 }

return(ord_time);
}

 

 

 

Mohammad Rizal Bin Rahmat
622
Mohammad Rizal Bin Rahmat  
Mohammad Rizal Bin Rahmat:
Just notice you edited... that was fast... thank you so much.. will test
Great work... appreciate it.... it works... what's the catch here?
tele2112
394
tele2112  
please my friend code that task for me, i know you can do it, it would be great
Volli
21
Volli  
Fahad3MQL4 2016.07.20 09:08     RU

Hi,

This is my first try in programming a custom indicator, the indicator works, however, it wont refresh until I change the frame then come back to it.

I know it is a logic issue, but I would appreciate any help.

I want it to calculate every bar, however, it will display history bars only, not current one. 

Files:
improved_strength_of_bar_score.mq4 8 kb

 

-------------------------------------------------------------------------------------------------------------------

Line 151. Zero divide.

/ ( High [ pos ] - Low [ pos ] )

If some bar will have 1 pips?

So

must be

 double H_L=( High [ pos ] - Low [ pos ] ); if(H_L==0) H_L=1;

... / H_L

 

Fahad3MQL4
13
Fahad3MQL4  

Thank you Volli.

 

It works fine now. 

Volli
21
Volli  
Fahad3MQL4:

Thank you Volli.

 

It works fine now. 

My pleasure.
Volli
21
Volli  
Michalis Phylactou 2016.07.21 16:58     RU

Hello

As I haven't worked with creating clickable objects on a chart yet. 

Can someone give me a code that

- Creates a button that closes all active trades once clicked

- Creates an text box that takes number input and a submit button that reads the number into the EA.

It will help me get a move on.

Thank you

---------------------------------------------------------------------------------------------------------------------------

It is creates buttons and open buy or sell.

I think you will understand how edit it.

 

Files:
Michalis Phylactou
12179
Michalis Phylactou  
Volli:
Michalis Phylactou 2016.07.21 16:58     RU

Hello

As I haven't worked with creating clickable objects on a chart yet. 

Can someone give me a code that

- Creates a button that closes all active trades once clicked

- Creates an text box that takes number input and a submit button that reads the number into the EA.

It will help me get a move on.

Thank you

---------------------------------------------------------------------------------------------------------------------------

It is creates buttons and open buy or sell.

I think you will understand how edit it.

 

Thank you Volli
To add comments, please log in or register