Log in or register to download unlimited Forex robots!
Trying to create an EA that will tell me every time the price moves by
Trying to create an EA that will tell me every time the price moves by about 10 points
Hi
I’m fairly new to coding and especially to MQL4. I’ve tried the below code in a few different ways. What I am trying is,
Create a start price level, and if the Ask price is higher than this level, automatically create a new target level, which would be the current Ask price, plus 10 points (and for the first question to become disabled (in place of the new question) in order to stop getting infinite alerts when price is above. And now, if the price goes another 10 points higher, the alert will be triggered again, repeating the last steps. And the same for the opposite direction, so any time a level is hit, then a new target is put up above and below of 10 points.
I have some ideas, but I’m finding it difficult to implement the code, and may be missing a few functions or statements that are needed in MQL4.
Like for example, if the first level to check is above the start price level, then keep asking the question, but as soon as the Ask price goes above this level, stop asking the question and send an alert, but now start asking a new question for another 10 points higher than the ask price that triggered the alert.
So if someone can tell me what I need to get acquainted with here I would very much appreciate it. Below is one way I tried to do it, but I haven’t done anything much better than that.
Thanks
extern int AddPipp = 1000;
extern int SubtractPipp = 1000;
void OnTick()
{
double target = 27820;
if(Ask > target)
Alert(Ask);
target target + AddPipp*Point;
}
- Total number of registered users: 77,563
- Registered users today: 5
- Newest registered user: Thucy2023
- Total number of topics: 11,778
- Total number of posts: 38,458
Online users: 2,791 guests, 78 Members:
Abdullah Alramzi, admin, Anthony258, Asbu, aussiesteve, azfxtrade, Biren, Brasky4eva, brunox, BUNDER, cowboy25, Daniel Higgins, Dayyaan Williams, defipro, diversanta, DRIIYKy, edwinses, emmie789, Eric Uzor, fahmiop, farry, fastlane2021, fjohnny, flairandflowers, Gerard Collins, ghfxwealth, gohang, gr8adroit, guska, harrydapel, hgmt4, hhh45, Higor Asano, IamSolomonChika, igiepascua, Investor, Joshua Allison, Justin Schmitgen, justinayu, Khunmon, KKH, Labas, Lars Dalgren, Luisbia, MARGARETKIRKLAND19, marketingwithmark, MartinK, masterpieces86, Mathanes Uchenna FHemanaq I, Mendocino, moneyjolt, Mostafa Moaseri, mt4talk001, neagoelaur, nkosinathi_mkondwane, Oupas25, phgja1, pigboy, Purgeaudio, Rosecharity40, Santiago, sasastephe, Simone Cik Cicala, skinvestor1978, spark2023, ssehrat, ssnow327, Steven jolivet, Thucy2023, trader.user1980, tzt, umitege, webgalaxy, xv16, Xxsticsxx, Yowis Zha, Zoltan0013, 西伯利亚风
The content on the MT4talk website is created by its users (MT4talk forum members). MT4talk does not sell Forex robots and does not offer support for them. MT4talk only offer PRO membership which allows for unlimited downloads of content from any forum topic or post. The updates for Forex robots may be limited or not happen at all, depending on who created the robot.
We are testing Forex robots in real-life conditions! We use a demo account to test some of the robots and the results are still accurate. We are not financial advisors and cannot advise you to invest your money. Our aim is to find good market analysis solutions using different strategies that can benefit our community.
CFTC RULE 4.41 – HYPOTHETICAL OR SIMULATED PERFORMANCE RESULTS HAVE CERTAIN LIMITATIONS. UNLIKE AN ACTUAL PERFORMANCE RECORD, SIMULATED RESULTS DO NOT REPRESENT ACTUAL TRADING. ALSO, SINCE THE TRADES HAVE NOT BEEN EXECUTED, THE RESULTS MAY HAVE UNDER-OR-OVER COMPENSATED FOR THE IMPACT, IF ANY, OF CERTAIN MARKET FACTORS, SUCH AS LACK OF LIQUIDITY. SIMULATED TRADING PROGRAMS, IN GENERAL, ARE ALSO SUBJECT TO THE FACT THAT THEY ARE DESIGNED WITH THE BENEFIT OF HINDSIGHT. NO REPRESENTATION IS BEING MADE THAT ANY ACCOUNT WILL OR IS LIKELY TO ACHIEVE PROFIT OR LOSSES SIMILAR TO THOSE SHOWN.
Disclaimer - No representation is being made that any Forex account will or is likely to achieve profits or losses similar to those shown on backtests in this forum. In fact, there are frequently sharp differences between hypothetical performance results and the actual results subsequently achieved by any particular trading program. Hypothetical trading does not involve financial risk, and no hypothetical trading record can completely account for the impact of financial risk in actual trading. All information on this forum is for educational purposes only and is not intended to provide financial advice. Any statements posted by forum members or the MT4talk EA Tester Team about profits or income expressed or implied, do not represent a guarantee. Your actual trading may result in losses as no trading system is guaranteed. You accept full responsibilities for your actions, trades, profit or loss, and agree to hold the MT4talk team and forum members of this information harmless in any and all ways.
Affiliates Disclaimer - The website may have links to partner websites, and if you sign up and trade through these links, we will receive a commission. Our affiliate partners are FXOpen, FBS, LQDFX, and MyForexVPS.
Copyright MT4talk.com Forum Rules - Privacy Policy.