Forex



Go Back   Forex Trading > Training > Metatrader > Metatrader 4 mql 4 - Development course > Questions
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
  #1471 (permalink)  
Old 05-03-2009, 08:12 PM
Junior Member
 
Join Date: Feb 2009
Posts: 2
atomi50 is on a distinguished road
Hello coders and fellow traders, I have a question but more about logic .

I am (unsuccessfully) trying for quite some time to do a simple EA and hopefully you will help me to do a next step.

I have a custom indicator ( 2MA CrossoverWithPrice ) and I would like to make a buy when the blue arrows appear and sell when red arrow appears.

I called the indicator with iCustom function like this:


iCustom(NULL,0,"2MA CrossoverWithPrice",0,0,CLR_NONE);

and compiled the EA and it seems everything is ok since I get alert on chart when I attach it ( says that custom indicator is attached)

What bothers me is that I don't know what to do next,how to tell the EA to buy and sell because the indicator creates 2 types of arrows.

Can anybody help me in any way? advice or anything please?
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
  #1472 (permalink)  
Old 05-07-2009, 12:59 AM
willmalou's Avatar
Member
 
Join Date: Apr 2006
Posts: 44
willmalou is on a distinguished road
Trade Context busy

Hi does anyone know of a way to keep sending a close or open to your broker if you keep getting trade context busy signal?
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
  #1473 (permalink)  
Old 05-09-2009, 10:55 PM
Junior Member
 
Join Date: Feb 2008
Posts: 29
dgrspencer is on a distinguished road
adding MA levels to an indicator

Afraid I can't help with the above questions as I'd bet I'm the newest wanabe programmer here

I have successfully (finally!) done my first simple indicator which simply places 4 EMAs onto a chart - and they can be adjusted WOW! I'm chuffed actually

Wot I'd now like to do is have the option of adding levels to one or more of the EMAs. Does anyone know how to do this in the code? Also is it possible to have them as an extern variable - to be able to vary the levels - or to do this would if have to be another parameter?

Once I can crack this, I'll add show boolean things so I can turn each EMA off - small steps at a time. The theory is, find the best fitting EMA and add levels showing the range (maybe 2 levels up and two down).

Thanks in advance,

Dave
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
  #1474 (permalink)  
Old 05-10-2009, 12:06 AM
Senior Member
 
Join Date: Nov 2006
Posts: 308
luxinterior is on a distinguished road
Quote:
Originally Posted by willmalou View Post
Hi does anyone know of a way to keep sending a close or open to your broker if you keep getting trade context busy signal?
You'd have to put the ordersend in a loop and check the response from your broker. If the response is -1 send the order again. You might want to put a slight delay before you send it again using the Sleep function.

Good luck

Lux
__________________
Build An Expert Advisor. FREE E-course As Seen On TV
ForexArea.com
Users of Gap Trader from 'Forex-Assistant' MUST Read This
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
  #1475 (permalink)  
Old 05-10-2009, 12:11 AM
Senior Member
 
Join Date: Nov 2006
Posts: 308
luxinterior is on a distinguished road
Quote:
Originally Posted by atomi50 View Post
Hello coders and fellow traders, I have a question but more about logic .

I am (unsuccessfully) trying for quite some time to do a simple EA and hopefully you will help me to do a next step.

I have a custom indicator ( 2MA CrossoverWithPrice ) and I would like to make a buy when the blue arrows appear and sell when red arrow appears.

I called the indicator with iCustom function like this:


iCustom(NULL,0,"2MA CrossoverWithPrice",0,0,CLR_NONE);

and compiled the EA and it seems everything is ok since I get alert on chart when I attach it ( says that custom indicator is attached)

What bothers me is that I don't know what to do next,how to tell the EA to buy and sell because the indicator creates 2 types of arrows.

Can anybody help me in any way? advice or anything please?
Well you're using the icustom incorrectly for a start. The last variable should be the bar that you want to check, usually 0 or 1, or it could be a variable. Not sure why you're sending a color?

The second to last variable is the buffer you're trying to return. If it's only got the two arrows I'd guess buffers 0 and 1. So what you'd do is check if either are set to something other than 0 or NULL, depending on the indicator. You'd need to look at the indicator code to figure out which buffer is related to which arrow and then use them accordingly.

Read up on the icustom function again.

Good luck

Lux
__________________
Build An Expert Advisor. FREE E-course As Seen On TV
ForexArea.com
Users of Gap Trader from 'Forex-Assistant' MUST Read This
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
  #1476 (permalink)  
Old 05-10-2009, 05:04 PM
Member
 
Join Date: Jan 2009
Posts: 33
JForex78 is on a distinguished road
Plot Lower TF MA-Cross on Higher TF Chart?

Hi,


I want to know how do I plot a Lower Timeframe MA cross on a Higher Timeframe chart.


e.g. I want to plot an arrow on H1 chart when M15 's MA5 and MA10 cross.


Please let me know.


Thanks,

JForex.
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
  #1477 (permalink)  
Old 05-10-2009, 09:24 PM
Member
 
Join Date: Nov 2008
Location: Texas
Posts: 32
Chilibowl is on a distinguished road
Can anyone help me to better understand how to modify code to allow EA to execute simultaneous orders in several instances (in other words I am testing the same EA, on several pairs at once, and am using different magic numbers for each instance.)

The original code includes this:

int total=OrdersTotal();
if(total<1)

And I think this is where the problem is. If I increase the number, it merely executes several orders on the same bar (M15) for the same pair. If left if(total<1), then it will not allow for simultaneous orders on different pairs.

Can I change something about the tick or bar to allow only one order at a time per pair, but several orders for all pairs that have EA (with different magic number) attached??

Thanks to anyone who can help or offer input!

Chili
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
  #1478 (permalink)  
Old 05-10-2009, 11:24 PM
1Dave7's Avatar
Senior Member
 
Join Date: Aug 2007
Posts: 183
1Dave7 is on a distinguished road
Cool Confused on multiple if statements

/////////////////////START TRADING ON SUNDAY/////////////////////////

StartDay=7; StartHour=1; StartMinute=55;


{
if(TimeDayOfWeek(TimeCurrent())==StartDay)
{
if(TimeHour(TimeCurrent())==StartHour)
{
if(TimeMinute(TimeCurrent())==StartMinute)
{
}
}
}
}

I am trying to get my EA to activate when day seven roles around (Day 7), and Hour 1 roles around, and 55 minutes roles around. What am I doing wrong. Today I started up the computer and the EA started trading right away (before hour 1)!. Please assist.

Thanks!

Dave
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
  #1479 (permalink)  
Old 05-11-2009, 02:57 AM
Senior Member
 
Join Date: Nov 2006
Posts: 308
luxinterior is on a distinguished road
Quote:
Originally Posted by JForex78 View Post
Hi,


I want to know how do I plot a Lower Timeframe MA cross on a Higher Timeframe chart.


e.g. I want to plot an arrow on H1 chart when M15 's MA5 and MA10 cross.


Please let me know.


Thanks,

JForex.
An MA on any chart is just a higher/lower version of an MA on a higher/lower time frame. For example if you put a 60MA on a 5 min chart but want to see what it looks like on an hour chart you would just multiply 60 by 12 (5 min intervals in an hour). So a 720 MA on an hour chart is the same as a 60 MA on a 5 min chart.

Make sense?

Lux
__________________
Build An Expert Advisor. FREE E-course As Seen On TV
ForexArea.com
Users of Gap Trader from 'Forex-Assistant' MUST Read This
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
  #1480 (permalink)  
Old 05-11-2009, 03:01 AM
Senior Member
 
Join Date: Nov 2006
Posts: 308
luxinterior is on a distinguished road
Quote:
Originally Posted by 1Dave7 View Post
/////////////////////START TRADING ON SUNDAY/////////////////////////

StartDay=7; StartHour=1; StartMinute=55;


{
if(TimeDayOfWeek(TimeCurrent())==StartDay)
{
if(TimeHour(TimeCurrent())==StartHour)
{
if(TimeMinute(TimeCurrent())==StartMinute)
{
}
}
}
}

I am trying to get my EA to activate when day seven roles around (Day 7), and Hour 1 roles around, and 55 minutes roles around. What am I doing wrong. Today I started up the computer and the EA started trading right away (before hour 1)!. Please assist.

Thanks!

Dave
Take another look at the help file.

Quote:
Returns the current zero-based day of the week (0-Sunday,1,2,3,4,5,6) of the last known server time.
Lux
__________________
Build An Expert Advisor. FREE E-course As Seen On TV
ForexArea.com
Users of Gap Trader from 'Forex-Assistant' MUST Read This
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
forex, histogram, JMASlope, ToR 1.20, ZUP_v1.mq4


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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


All times are GMT. The time now is 04:57 AM.



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