Forex
Google
New signals service!

Go Back   Forex Trading > Programming > Metatrader Programming


Register in Forex TSD!
Trading Systems Leaders in this forum (automated trading systems) are winning more than 3000 pips in a month (30000$ investing one lot every time).
Click here to register and get more information

 
 
LinkBack Thread Tools
 
Old 10-09-2007, 01:48 PM
1Dave7's Avatar
Member
 
Join Date: Aug 2007
Posts: 82
1Dave7 is on a distinguished road
Smile

Quote:
Originally Posted by Sendra View Post
Hi, everyone

I tried to create an EA, and I got the following error message:

'\end_of_program' - ending bracket '}' expected C:\...\My_First_EA.mq4(96,1)

I double-clicked it, get to the line, then check it with opening-ending brackets prior to it, and still don't know where I made mistake.

This is the second EA I tried, with the same error message, based on the same indicator.

Thank you.
Sendra, send the program to my email address as an attachment and I will look at it and try to fix it. Normally the problem is a bracket missing after a statement. Unfortunately, this is a low level language and because it is a basic language, it cannot tell you exactly where the error is many times, so it defaults to the error it is showing you. Only experience in coding will help in troubleshooting this type of error.

Dave
<><<<

ddiebold7@aol.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
 
Old 10-10-2007, 09:48 PM
Member
 
Join Date: Feb 2007
Posts: 73
mer071898 is on a distinguished road
anyone help with coding?

Can anyone code this EA minus the price entry and hibernation function plus add a breakeven function? I only have the EX4 file as the owner will not make any modifications but said it was pretty straightforward to make. If someone has an EX4 decompiler that would help. I would be willing to pay for this EA if someone her wants to take it on. Here is the thread if someone needs more info on how it works along with the EA and the Breakeven EA I would like to incorporate into it.

FXTradepro: Strategy using a “Semi-Martingale” Position Sizing
Attached Files
File Type: ex4 FXTradepro Manager 24 - OCT 2007.ex4 (21.5 KB, 23 views)
File Type: mq4 BreakEvenExpert_v1-10.mq4 (3.1 KB, 20 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
 
Old 10-11-2007, 11:55 AM
Member
 
Join Date: Sep 2006
Posts: 59
waaustin is on a distinguished road
Ralph, HELP with some Daily Close logic

Hello Ralph.

Perhaps, if you wouldn't mind a bit of guidance. This has been a bit of a challenge for me to figure out!! I want to define some conditions for the EA to look at to determine whether or not to close an open trade. Let's just use a buy order as an example (I know Sell order would be the opposite logic). So, I have an Buy order opened on a Monday. I want the EA to look at the Daily Close over the next X # of days. If the Daily Close on each of the next X number of days (let's say 5 days for example) is lower than the Order Open price of the trade, then I want the EA to execute an OrderClose to closeout the trade. I was also thinking another possible part of this condition I might want the EA to look at is if the Daily close over each of the next X number of days was lower than the previous days close. Also too, My EA runs on the one hour time frame.

I hope I explained what I want to accomplish clearly enough for you to understand.

Thanks in advance for your help.

Last edited by waaustin; 10-11-2007 at 01:58 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
 
Old 10-11-2007, 11:46 PM
wolfe's Avatar
Senior Member
 
Join Date: Jan 2006
Posts: 681
wolfe is on a distinguished road
Coding Help Please

I'm not asking for the coding of an EA, just a little help with one problem.

What I would like to code is this, if I have an open long order I want to be able to call the Highest quoted price that the order has seen since that specific long order opened. Obviously, when the order first opens, the open price would be returned. If the order increases by 20 pips, the price of OrderOpenPrice() + 20 pips would be returned. If the price then decreases by 10 pips, the price OrderOpenPrice() + 20 would still be the returned value. I know this can be done within a specific bar by using OrderOpenPrice() + High[0], but when a new bar is formed, High[0] becomes High[1]. I will also use the same logic in reverse to return the lowest value a specific short order has seen. When the order closes, the returned values will re-set to zero.

I'm having trouble figuring this one out, can anyone help?

Thank You!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
 
Old 10-12-2007, 12:14 AM
jimven's Avatar
Senior Member
 
Join Date: Mar 2007
Location: Upstate New York
Posts: 119
jimven is on a distinguished road
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!
__________________
Success is more perspiration than inspiration . . .
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
 
Old 10-12-2007, 12:40 AM
wolfe's Avatar
Senior Member
 
Join Date: Jan 2006
Posts: 681
wolfe is on a distinguished road
Quote:
Originally Posted by jimven View Post
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?

Thanks
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
 
Old 10-12-2007, 12:43 AM
wolfe's Avatar
Senior Member
 
Join Date: Jan 2006
Posts: 681
wolfe is on a distinguished road
Quote:
Originally Posted by jimven View Post
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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
 
Old 10-12-2007, 04:06 PM
jimven's Avatar
Senior Member
 
Join Date: Mar 2007
Location: Upstate New York
Posts: 119
jimven is on a distinguished road
Quote:
Originally Posted by wolfe View Post
Now that I think about it, your suggestion will probably work. Thank you! I'll try it out.
Good. When the trade position is closed, you want to set the variable to zero. When the next trade opens, you start the process again.

Of course my example was for a "BUY" position. For "SELL," you want to get the lowest value saved.
__________________
Success is more perspiration than inspiration . . .
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
 
Old 10-12-2007, 05:25 PM
Member
 
Join Date: Sep 2006
Posts: 59
waaustin is on a distinguished road
Help with negative values ??

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
 
Old 10-13-2007, 12:49 AM
wolfe's Avatar
Senior Member
 
Join Date: Jan 2006
Posts: 681
wolfe is on a distinguished road
Quote:
Originally Posted by waaustin View Post
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).

Hope this helps
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
 

Bookmarks
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to code this? iscuba11 Metatrader 4 mql 4 - Development course 1 08-03-2007 04:22 PM


All times are GMT. The time now is 07:46 AM.



Search Engine Friendly URLs by vBSEO 3.2.0 ©2008, Crawlability, Inc.