MQL4 Learning

 

[CUT] This post was deprecated.

 

stop-and-reverse TSL

hi everybody,

i am trying to find an indicator and ea that would set a benchmark distance a stop-and-reverse stoploss level at

X pips from the lowest low (highest high) since the last triggered bearish (bullish) trend.

say eur/usd is 1.2210 in a bearish trend, and lowest low since the indicator triggered the bearish trend at 1.2250 about 45 minutes ago, is 1.2200. if i set X=40, the benchmark for SAR system should be fixed at 1.2240. if price makes a new low to 1.2180, the new benchmark will move to 1.2220, down 20 pips as price did. else if price goes up to 1.2215, the benchmark will do nothing and wait for being hit. if it is hit at 1.2240, a long will be triggered with the initial highest high at 1.2240, so new benchmark SAR level will be 1.2240-50pips=1.2190.

i would appreciate if anyone can point out to something useful for this kind of a stoploss indicator and/or EA.

importantly, i dont want "close" prices to be referenced in calculations, either high or low of any of the bars should be referenced in calculating the SAR.

i think it is very simple to code but most of the programmers i asked for help was either busy or was not interested i suppose. but i need such a thing to stop me, or i am losing a lot of money :.(

thanks

 

OrderCloseBy()

Could someone explain to me how the OrderCloseBy() function works exactly?

I've already done a search on this forum and on metaquotes.net for detailed information, but with no luck.

bool OrderCloseBy(int ticket, int opposite, color Color=CLR_NONE)

The obvious scenario is when the order that "ticket" refers to and the order that "opposite" refers to are both the same size - they both cancel eachother out completely.

But what happens when the sizes of the 2 orders are different?

1. An error code is generated and nothing is closed?

Or

2. The smaller sized order is closed (its ticket# is removed from the system) and the larger sized order (minus the size of the smaller order) stays open (its ticket# remains in the system)?

Or

3. Something else?

 

I must be missing something...

I might be blind or i'm missing something... But when i trade manualy and put an instant execution order on long EUR/USD at price 1.2700 with 10 lots. Then i will let the trade run but as soon EUR/USD hits 1.2800 i want to close 5 of the 10 lots and let the other run. I know i can use Close Order and change volume to 5 and just close them, but is there a way to make this automaticly within the user interface or do i need a small script for it? So i dont have to watch the screen all the day....

/Best Regards

 

NEWBIE Needs help

Hi, I am interested in obtaining info on writing a program using expert indicators. Or possibly hiring someone to teach me. Can anyone direct me, I am in NYC and have no programming knowledge but I do have a vast amount of financial markets experience.

Thank you in advance.

 
Hubert:
Hi, I am interested in obtaining info on writing a program using expert indicators. Or possibly hiring someone to teach me. Can anyone direct me, I am in NYC and have no programming knowledge but I do have a vast amount of financial markets experience. Thank you in advance.

You will find in this forum almost everything.

1. You need to read the Codersguru lessons. Even if you are advanced user or programmer:

- https://www.mql5.com/en/forum/general and

- http://www.metatrader.info/

And there are some usefull threads as well:

- https://www.mql5.com/en/forum/172968

- https://www.mql5.com/en/forum/173826

2. In Analytics section there are some other lessons (MT3 in English, something in Russian, and so on).

 

do u have any suggestions?

int start()

{

......

for (i=Bars-1;i>0;i--)

{

if (Close=a+b)

m=i;

}

......;

}

as new quotations received, new sticks appears,and the index 0,1,2.... are pointed to different sticks. for example, Close[5] of current time is equal to previous Close [4] after receiving a new quotation. now, i assign i to m, the Close[m] is different between before and after receiving new quotations. how can i point to the same sticks with a fixed index or a varible whenever i reveive new quotations? can you give me some suggestions? thanks!

 

MT4 Questions

Hi, I been trying MT4 for quite some days now, and I have a few

questions regarding the software. Any help regarding these Questions

would be deeply appreciated...

1.) How do I enable Global Crosshairs...meaning how do I enable

crosshairs on all charts at the same time without clicking each chart

& enabling it one by one, and it is possible for the crosshairs to

stay on the chart even if the mouse button is pressed?

2.) Is there anyway to automatically load scripts in MT4? I have read

that it's not possible, but has anyone done a work around? Mainly I

use the Period Converter, can this script be achieved in some other

form which can be loaded automatically each time I open MT4?

3.) Is there anyway to hide the Indicator info(what the indicator is

and its settings), from showing to the top left of the indicators?

4.) Is there a script/expert etc, that i can use to enter(Buy/Short) a

"market order" with one click and exit(Sell/Cover) the position with

one click? The currect way in which you open several windows is slow

because I'm a scalper.

I hope I didn't go all out in asking questions, please bear with me, I

have not searched all the FAQs and all the Forums regarding to

Metatrader, that would take me years, but I have searched certain

keywords on metatrader forums and have not found anything that would

be of any help. Please answer in any way you can. Thanks

 

How to display Graphics on an EA?

I have been working on an EA the last few days and with the help of this forum I have made some progress. I want to know how I would print an arrow or sometime of graphic that indicates where It is getting in a trade and where it is getting out. I no how to do it for an indicator but not for an EA.

Thanks in advance

Randy

 

intervals

I need to have equal intervals on horizontal and vertical axes so that a line i draw at certain degree angle is correct. How to scale the graph to achive equal intervals?

 

Access to Indicator variable

Hello all.

Is there anyway to access the variables of an indicator from an Expert System that is running on the same chart?

I'd like to put a pivot point indicator on my chart but my EA needs to know the values of the PPs.

Thanks.

Daniel

Reason: