Forex



Go Back   Forex Trading > Programming > MetaTrader
Forex Forum Register More recent Blogs Calendar Advertising Others Help






Register
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.
See more

Reply
 
Thread Tools Display Modes
  #401 (permalink)  
Old 10-08-2007, 11:07 AM
Senior Member
 
Join Date: May 2006
Posts: 156
waltini is on a distinguished road
Have a look at these

I also struggle with the coding. I keep looking for ea's that do something similar to what I am trying to do.

I have attached some hedging ea's for you to look at. Is the hedge in a different currency? You may have to use MarketInfo() if that is the case.
Attached Files
File Type: mq4 HedgeEA_v5.6.mq4 (16.6 KB, 33 views)
File Type: mq4 HedgeEA_v6[1].0.mq4 (22.9 KB, 34 views)
File Type: mq4 HedgeHog_v1.3.mq4 (5.0 KB, 34 views)
File Type: mq4 Hedger.mq4 (4.3 KB, 34 views)
File Type: mq4 HedgeTraderv1023.mq4 (13.3 KB, 33 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #402 (permalink)  
Old 10-08-2007, 11:09 AM
Senior Member
 
Join Date: May 2006
Posts: 156
waltini is on a distinguished road
More EA's

Can only upload 5 ea.s at a time.
Attached Files
File Type: mq4 HePHS_V[1][1].3.mq4 (4.5 KB, 40 views)
File Type: mq4 KEHedge.mq4 (11.7 KB, 45 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #403 (permalink)  
Old 10-08-2007, 02:57 PM
Member
 
Join Date: Oct 2006
Posts: 59
Jovager is on a distinguished road
How write "If last trade was winnig"

In an EA how write "If last trade was winning" (for this pair) then ...

Thx for help.

Jo
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #404 (permalink)  
Old 10-09-2007, 01:35 AM
Junior Member
 
Join Date: Oct 2007
Location: china
Posts: 4
wuzuwang is on a distinguished road
Smile about MarketInfo()

hello to everyone!

//
double A = MarketInfo("EURUSD",MODE_BID);
doube B = MarketInfo("USDJPY",MODE_BID);
double C = MarketInfo("EURJPY",MODE_BID);

init()
{
A = MarketInfo("EURUSD",MODE_BID);
B = MarketInfo("USDJPY",MODE_BID);
C = MarketInfo("EURJPY",MODE_BID);
}
int start()
{
...



}

//

why does those codes not works? when complies,that comes to so many errors:

'MarketInfo' - initialization expected
'A' - variable not defined ...
.....and so on

Last edited by wuzuwang; 10-09-2007 at 01:37 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #405 (permalink)  
Old 10-09-2007, 10:46 AM
Senior Member
 
Join Date: May 2006
Posts: 156
waltini is on a distinguished road
This worked for me

Quote:
Originally Posted by Jovager View Post
In an EA how write "If last trade was winning" (for this pair) then ...

Thx for help.

Jo
double LotsOptimised()
{

double lots = InitialLots;//default lots 0.1 - there will be no error if lots will not be set by the other part of the code

// int total = OrdersHistoryTotal();
for(int i=0;i<OrdersHistoryTotal();i++) // scan all closed / cancelled transactions
{
OrderSelect(i, SELECT_BY_POS, MODE_HISTORY );

if(OrderSymbol() == Symbol()&& OrderMagicNumber()==MagicNumber)
{
if(OrderProfit()<0)
{
lots = NormalizeDouble(OrderLots() * LotsFactor,2);
}
else
{
lots=InitialLots;
}
}
}
return(lots);
}

I used this to check if the last closed trade was a winner or not. If not I martingaled the lots. Hope it helps.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #406 (permalink)  
Old 10-09-2007, 02:48 PM
1Dave7's Avatar
Senior Member
 
Join Date: Aug 2007
Posts: 183
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!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #407 (permalink)  
Old 10-10-2007, 10:48 PM
Member
 
Join Date: Feb 2007
Posts: 98
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, 40 views)
File Type: mq4 BreakEvenExpert_v1-10.mq4 (3.1 KB, 36 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #408 (permalink)  
Old 10-11-2007, 12:55 PM
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 02:58 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #409 (permalink)  
Old 10-12-2007, 12:46 AM
wolfe's Avatar
Senior Member
 
Join Date: Jan 2006
Posts: 818
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!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #410 (permalink)  
Old 10-12-2007, 01:14 AM
jimven's Avatar
Senior Member
 
Join Date: Mar 2007
Location: Upstate New York
Posts: 140
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!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
Reply

Bookmarks

Tags
#include, candle time, CHinGsMAroonCLK, code, coders guru, conditionally, dll, eli hayun, Eur_harvester.ex4, expert adviser, expert advisor, forex, higher high, how to code, indicator, I_XO_A_H, kehedge, mechanical trading, metatrader command line, mt4, MT4-LevelStop-Reverse, OrderReliable.mqh, programming, rectangle tool, trading, volty channel stop


Currently Active Users Viewing This Thread: 2 (1 members and 1 guests)
kazumine88
Thread Tools
Display Modes

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 Off
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 05:22 PM


All times are GMT. The time now is 10:49 AM.



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