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

Reply
 
LinkBack (1) Thread Tools Display Modes
  #391 (permalink)  
Old 10-05-2007, 12:30 PM
lowphat's Avatar
Senior Member
 
Join Date: Sep 2005
Posts: 199
lowphat is on a distinguished road
double bid = MarketInfo("GBPUSD",MODE_BID);
double ask = MarketInfo("GBPUSD",MODE_ASK);
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #392 (permalink)  
Old 10-06-2007, 01:49 AM
Junior Member
 
Join Date: Sep 2007
Posts: 2
celticwarrior72 is on a distinguished road
Help needed - combining timeframes

I am trying to develop an EA that uses two signals:

1) An EMA based indicator from the D1 chart that indicates the major trend (long, short, or flat)
2) A MACD based indicator from the H4 chart that gives the trading signal (long or short)

I have developed both my custom indicators - they work fine in their respective charts. However, I am having difficulty combining them to work together as an EA

How do you go about combining timeframes in an EA?

Thanks.

CelticWarrior72
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #393 (permalink)  
Old 10-06-2007, 04:52 PM
Junior Member
 
Join Date: Oct 2007
Posts: 28
NTrader is on a distinguished road
How to change position sign with 1 command

In mql4 what is the command to change the sign of a position with only one order? I mean, for example, if I'm long on EURUSD of 5000 I want to be short of 5000 with a operation..

Thanks
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #394 (permalink)  
Old 10-07-2007, 08:14 PM
judex001's Avatar
Junior Member
 
Join Date: May 2006
Posts: 13
judex001 is on a distinguished road
How many lots on the chart

Hi,

I have an EA attached to a chart - When this EA open a postion, is it possible to show on the chart, as a label for example, with how many lots did the EA enter the position ?

Example : I would like to show on my chart this sentence when the EA enter a position : EA buy 2.9 lots of EURUSD @ 1.4000

Anyone know How can i do that ?

Thanks

Regards
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #395 (permalink)  
Old 10-08-2007, 12:31 AM
Junior Member
 
Join Date: Aug 2007
Posts: 9
mish is on a distinguished road
What's wrong with this code?

I'm battling with making my expert advisor do as I tell it to

I'm simply trying to keep hedge ratios roughly even

simply put close one Sell in profit at a time then close one Buy in profit at a time and keep alternating

my code includes an offset of 5 unhedged positions

My girlfriend and I are pulling our hair out!

We try as best we can to code this ourselves before we ask for help but we are getting absolutely no where!

Many thanks to this forum and to the people that have helped us we gratefully acknowledge, these people have really helped our learning curve
Attached Files
File Type: txt what's wrong code.txt (1.5 KB, 10 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #396 (permalink)  
Old 10-08-2007, 10:07 AM
Senior Member
 
Join Date: May 2006
Posts: 147
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, 17 views)
File Type: mq4 HedgeEA_v6[1].0.mq4 (22.9 KB, 18 views)
File Type: mq4 HedgeHog_v1.3.mq4 (5.0 KB, 21 views)
File Type: mq4 Hedger.mq4 (4.3 KB, 21 views)
File Type: mq4 HedgeTraderv1023.mq4 (13.3 KB, 19 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #397 (permalink)  
Old 10-08-2007, 10:09 AM
Senior Member
 
Join Date: May 2006
Posts: 147
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, 21 views)
File Type: mq4 KEHedge.mq4 (11.7 KB, 26 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #398 (permalink)  
Old 10-08-2007, 01:57 PM
Member
 
Join Date: Oct 2006
Posts: 56
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!
Reply With Quote
  #399 (permalink)  
Old 10-09-2007, 12: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 12:37 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #400 (permalink)  
Old 10-09-2007, 09:46 AM
Senior Member
 
Join Date: May 2006
Posts: 147
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!
Reply With Quote
Reply

Bookmarks

Tags
CHinGsMAroonCLK, I_XO_A_H

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

LinkBacks (?)
LinkBack to this Thread: http://www.forex-tsd.com/metatrader-programming/554-how-code.html
Posted By For Type Date
Need an experienced programmer? - Page 2 Post #0 Refback 09-24-2008 06:24 AM

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 08:19 PM.



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