How to code? - page 290

 

...

Not sure if this will solve your problem, but take a look at this : https://www.mql5.com/en/forum/general

Pava:
How to make my computer show words in Russian in indicators correctly?...Thanks...
 

...

mladen:
Not sure if this will solve your problem, but take a look at this : https://www.mql5.com/en/forum/general

thanks...will try

 

...

This is an example...My Mac doesn't like it!:)

"

//

// VisualOrders.mq4

// Dmitry Yakovlev

// dmitry_yakovlev@rambler.ru

// ?? ???? WebMoney R865705290089

//------------------------------------------------------------------

#property copyright "Dmitry Yakovlev, Russia,Omsk, WM R865705290089"

#property link "dmitry_yakovlev@rambler.ru"

#property indicator_chart_window

#import "shell32.dll" //Connect a dll (provided with Windows)

int ShellExecuteA(int hwnd,string Operation,string File,string Parameters,string Directory,int ShowCmd);

#import "user32.dll"

int MessageBoxA(int hWnd ,string lpText,string lpCaption,int uType);

#import

extern string _ModeProf="??????? 1-???????.,2-??????";

extern int ModeProf=2;

extern string _orders="?????????? ?????? ?? ???????:";

extern string _Type = "0 ???,-1 Sell,1 Buy";

extern int Type = 0;

extern bool CurOrders=true;

extern int lblSize=1;

extern bool HistOrders=true;

extern bool ShowProfits=true;

extern int ShiftProfits=0;

extern bool lShowTargets=true;

extern string _donate1="?? ???? :-) WebMoney";

extern string _donate2="R865705290089";

"

 

...

Those are Cyrilic letters, that is why they are not shown

If you have problem seeing them in metaeditor, do the following : in the menu of metaeditor tools->options->font set the script to Cyrilic. You will still be able to see regular latin letters + you are going to see Russian too (like this :

As of showing it in terminal window, I am afraid you will see it only if you have Russian Windows installed

Pava:
This is an example...My Mac doesn't like it!:)

"

//

// VisualOrders.mq4

// Dmitry Yakovlev

// dmitry_yakovlev@rambler.ru

// ?? ???? WebMoney R865705290089

//------------------------------------------------------------------

#property copyright "Dmitry Yakovlev, Russia,Omsk, WM R865705290089"

#property link "dmitry_yakovlev@rambler.ru"

#property indicator_chart_window

#import "shell32.dll" //Connect a dll (provided with Windows)

int ShellExecuteA(int hwnd,string Operation,string File,string Parameters,string Directory,int ShowCmd);

#import "user32.dll"

int MessageBoxA(int hWnd ,string lpText,string lpCaption,int uType);

#import

extern string _ModeProf="??????? 1-???????.,2-??????";

extern int ModeProf=2;

extern string _orders="?????????? ?????? ?? ???????:";

extern string _Type = "0 ???,-1 Sell,1 Buy";

extern int Type = 0;

extern bool CurOrders=true;

extern int lblSize=1;

extern bool HistOrders=true;

extern bool ShowProfits=true;

extern int ShiftProfits=0;

extern bool lShowTargets=true;

extern string _donate1="?? ???? :-) WebMoney";

extern string _donate2="R865705290089";

"
Files:
editor.jpg  143 kb
 

...

"extern string _donate1="на пиво :-)"...thanks...it worked

 

close base MACD

Hi.. can you help me to modify this exit by MACD cross 0. as usual this ea close if tp=x or sl=x point.

i have try but it still to difficult 4 me..

thank you very much... 1428maplus.mq4

Files:
1428maplus.mq4  30 kb
 
mladen:
Add something like this in your EA at the beginning of start() procedure :
if (TimeDayOfWeek(TimeCurrent())==5 && TimeCurrent()>=StrToTime("22:59")) { CloseAll(); return(0); }

Add this into the code :

[PHP]void CloseAll()

(All the code)

That will solve your points 2 and 3 (opened orders at Friday)

First point is rather complicated to code - you will probably need to redefine that rule

Thanks very much! For the last part would an event track listener code of some sort do the trick (just typing another suggestion I read)? If I'm correct, to increase the take profit of one trade when the other closes would require sub-parts of coding to make it up?

When two trade open with this EA however it does mean that at some point one will hit the stop loss (unless they range in the same area until the close all trades at a certain time bit), if two trades are open and one closes with a negative profit, the other open trade could respond to the negative profit by increasing the take profit? By the way, this is all happening on one symbol so far.

To put it more simply actually, would it be possible to increase the take profit of a trade once the other has closed regardless of what it's profit is? This is because the way I intend the EA to be is that if two trades are open and one does close it will be negative anyway.

Thanks again!

 
There is a couple of problems in that :

- searching through the list of closed orders can lead to wrong "related" order identification

- because of that EA would need to know what "other" order it should monitor. So each of the orders would need to know somehow about the other order ID (ticket). But that, due to lack of a field in which we (the users) can write something we want to use as info, is not possible. Comment field can be written only at a moment of order creation : there is no way we can alter it once the order is opened (only broker can do that) so we have no means of patching info to the order itself.

- if we can not save some info to the order itself, we can forget about some kind of modifications. For example : how can you tell from available fields of an order that it already has been modified (the take profit). I am not talking about some "global variables" (which are useless in case when you use terminal even on 2 different folders let alone on 2 different PC) nor about saving some states in the EA (what if it stops working - a case happening much more often than they wish to admit).

So, as far as I see with the constraints from above, that kind of conditional "behavior" is not possible to make without a real possibility of an error somewhere along the process

madmax3:
Thanks very much! For the last part would an event track listener code of some sort do the trick (just typing another suggestion I read)? If I'm correct, to increase the take profit of one trade when the other closes would require sub-parts of coding to make it up?

When two trade open with this EA however it does mean that at some point one will hit the stop loss (unless they range in the same area until the close all trades at a certain time bit), if two trades are open and one closes with a negative profit, the other open trade could respond to the negative profit by increasing the take profit? By the way, this is all happening on one symbol so far.

To put it more simply actually, would it be possible to increase the take profit of a trade once the other has closed regardless of what it's profit is? This is because the way I intend the EA to be is that if two trades are open and one does close it will be negative anyway.

Thanks again!
 

It does seem like quite a difficult task, what about going about it like this, when a trade is open (can be one or two trades) the take profit is altered once the price hits a certain level?

 

...

Why not using a trailing stop then?

I mean it would do almost 100% (almost) of what your original idea is and it is much, much easier to code

madmax3:
It does seem like quite a difficult task, what about going about it like this, when a trade is open (can be one or two trades) the take profit is altered once the price hits a certain level?