You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hello Everyone,
I am new the MQL5 forum and Forex trading (Within the last 3-4 monts), so please bare with me if I seem to ask dumb or ill-informed questions. I do have some limited experience with programming and writing code, as it was a requirement to take coding classes to pass my Mechanical Engineering degree. I am now working on my first script and have seem to run into some trouble. I am not looking for anyone to program my script for me (I won't say no if you insist on it though!), I am just looking to seek the guidance and help of people who have been doing this for much longer than I; Thank you for your help in advance.
I have attached the script for your viewing. The idea for the script goes like this:
1. I would like the 2 red lines (Take Profit and Stop Loss) to be set from the black line (Entry) price, and not from the current price when the script is executed for the second time. I assume it has something to do with replacing TimeCurrent() with something else in the lines: ObjectCreate("StopLine1", OBJ_HLINE, 0, TimeCurrent(), Close[0]+(1.7*ATR)+Spread); and ObjectCreate("StopLine2", OBJ_HLINE, 0, TimeCurrent(), Close[0]-(1.7*ATR)+Spread); but I am not sure what it would need to make it work?
2. The second problem that I am having is when I try to add or subtract the spread price to the same lines of code as described above. If you take out the addition or subtraction of the spread, the code seems to work, but when they are put back into the code, no Take Profit or Stop Loss Lines appear when the script is executed for the second time. I think an example would best describe how I think this should work.
Example:
Thank you once again for your help and expertise!
Sincerely,
Mitchell Eaton