Welcome to Forex-TSD!, one of the largest Forex forums worldwide, where you will be able to find the most complete and reliable Forex information imaginable.
From the list below, select the forum that you want to visit and register to post, as many times you want. It’s absolutely free. Click here for registering on Forex-TSD.
Exclusive Forum
The Exclusive Forum is the only paid section. Once you subscribe, you will get free access to real cutting-edge Trading Systems (automated and not), Indicators, Signals, Articles, etc., that will help and guide you, in ways that you could only imagine, with your Forex trading.
Elite Section
Get access to private discussions, specialized support, indicators and trading systems reported every week.
Advanced Elite Section
For professional traders, trading system developers and any other member who may need to use and/or convert, the most cutting-edge exclusive indicators and trading systems for MT4 and MT5.
Save the current bar's highest quoted value to a variable. Every time you get another quote, compare it with the value of the variable. If the new value is higher, save it to the variable. If the new value is lower, keep the variable the same.
if(variable < newquote)
variable = newquote;
Hope that helps!
Thank you for the help, I have one question though. What happens when the current bar is no longer the bar that the order opened in? What if the order opened in the bar 5 bars ago? Now I want the highest quoted value of 5 bars, the highest quoted price since the order opened. Will this still work?
Save the current bar's highest quoted value to a variable. Every time you get another quote, compare it with the value of the variable. If the new value is higher, save it to the variable. If the new value is lower, keep the variable the same.
if(variable < newquote)
variable = newquote;
Hope that helps!
Now that I think about it, your suggestion will probably work. Thank you! I'll try it out.
Could anyone share with what syntax and instructions I would use in mql to write some code in EA using the following:
(OrderProfit() < 0).
Except I really want to know when OrderProfit() is some specific value less than zero such as when the profit on an open trade is -1,250.00. For example:
Could anyone share with what syntax and instructions I would use in mql to write some code in EA using the following:
(OrderProfit() < 0).
Except I really want to know when OrderProfit() is some specific value less than zero such as when the profit on an open trade is -1,250.00. For example:
if (OrderProfit() < -1,250.00).
Thanks
I think you have the right idea. However you would probably want to use if (OrderProfit() <= -1250.00) Your OrderProfit() may never = -1,250.00, especially if a position is held for more than a day and swaps are involved. I think you would be safer to use less than or equal (<=). You may want to set an external double variable so you can change the negative amount if you wish to. Such as external double Loss_Value = -1250.00; then you could use if (OrderProfit() <= Loss_Value).
I am appealing to the experts out there to please come to my aid i need some to help me buld an EXPERT ADVISER META 4 TRADER for me i would be greatfull if my request is granted.
I am appealing to the experts out there to please come to my aid i need some to help me buld an EXPERT ADVISER META 4 TRADER for me i would be greatfull if my request is granted.
Hi vonokpasah,
Just for information: we are having few very good threads with templates to create EAs and indicators. For example:
Templates to create EAs and Indicators:
- some good templates are here;
- templates with some new codes are here.
- Programming Modules with many programming functions are here.
- function of "mql4 code": thread with codes.
Remember that any time you store data to temporary variables in an EA, the data will be gone if you reinitialize or restart the EA (or reboot your computer). This could have unexpected consequences regarding your trades. One possibility is that open trades will close, for example.
You can store data to Global Variables (using GlobalVariableSet and GlobalVariableGet). They remain in the terminal for two weeks (I think), even if undisturbed by your EA. But of course such data could quickly become just as problematic as lost data if you have a computer equipment problem.
In any event, your EA should be written defensively to prepare for loss of connection and the possibility of reinitialization.
__________________ Success is more perspiration than inspiration . . .
I don't see how it is possible to know SmRSI value with the following line, knowing that it has not been defined before and seems to me mathematically impossible.