Forex
Google
New signals service!

Go Back   Forex Trading > Metatrader Training > Metatrader 4 mql 4 - Development course > Questions


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 (2) Thread Tools Display Modes
  #711 (permalink)  
Old 08-04-2007, 05:43 AM
Junior Member
 
Join Date: Mar 2007
Posts: 10
Hartadi is on a distinguished road
Hi,

PHP Code:
int start()
{
int    i;

if ((
Year() >= X) && (Month() >= Y))
   {
   
Comment("===========",expired,"===========");
   return(
0);
   }

   
GetPosition StrToTime(StrGetPosition);
   
StartOrderTime StrToTime(StrStartOrderTime);
   
EndOrderTime StrToTime(StrEndOrderTime);

return(
0); 
My Question is :

is GetPosition, StartOrderTime, EndOrderTime will be executed?

Cheers
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #712 (permalink)  
Old 08-04-2007, 05:44 AM
Julia's Avatar
Junior Member
 
Join Date: Aug 2007
Posts: 17
Julia is on a distinguished road
Smile Questions

Hi,

A friend of mine told me about this site. She toled me they have the best mql programmers.

Here's one:

If I set a code, for example....to buy at a 15:30(most of the news time), I checked the economic calendar.

PHP Code:
if (Hour()==15
 {
   if (
Minute()>=30)
    {
      if (
Seconds()>=00
After this, something like this goes:

PHP Code:
OrderSend(Symbol()....................... 
Everyone writes it different,hehe.
Why can't it be the same?

Okay, here's the deal. For the above code, I want the OrderSend........and the continuing part to create a BuyStop 30 pips above the price at 15:30:00, and a SellStop 25 pips underneath the price at 15:30:00.

I asked my best friend, and she said to ask you guys. So, I really hope you guys are a big help.

I've spent weeks trying to figure out this code. I'm not kidding. So, will anybody that does coding in mql4 help me?


---Julia---
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #713 (permalink)  
Old 08-04-2007, 09:53 AM
SaxMan's Avatar
Member
 
Join Date: Mar 2006
Posts: 27
SaxMan is on a distinguished road
Quote:
Originally Posted by iscuba11 View Post
extern Bool Direction_Up=true;

if(Direction_Up==true) Dir="UP"; ///////////This is wrong conversion - How do I convert it to the proper syntax????

ObjectCreate("Dir", OBJ_LABEL, 0, 0, 0);
ObjectSetText("Dir", 10, "Arial", White);///////////This is wrong - How do I get it to display UP on the screen????
ObjectSet("Dir", OBJPROP_CORNER, 1);
ObjectSet("Dir", OBJPROP_XDISTANCE, 36);
ObjectSet("Dir", OBJPROP_YDISTANCE, 120);///



Dave
<><<<
Hi Iscuba11,

see code for fix & explanation

Code:
extern bool Direction_Up=true; //-- bool with a lower case "b"
string Dir; //-- Dir has to be declared as a string

if(Direction_Up==true) Dir="UP"; 
ObjectCreate("Dir", OBJ_LABEL, 0, 0, 0);
ObjectSetText("Dir",Dir, 10, "Arial", White); // -- you left out the text to print - you named the object only.
ObjectSet("Dir", OBJPROP_CORNER, 1);
ObjectSet("Dir", OBJPROP_XDISTANCE, 36);
ObjectSet("Dir", OBJPROP_YDISTANCE, 120);
Hope this helps,
SaxMan

Last edited by SaxMan; 08-04-2007 at 09:55 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #714 (permalink)  
Old 08-04-2007, 02:41 PM
Senior Member
 
Join Date: Dec 2006
Location: Ukraine
Posts: 491
Shinigami is on a distinguished road
Weeks?!
MQL4: automated forex trading, strategy tester and custom indicators with MetaTrader
search for OrderSend() - docs
Quote
OrderSend - MQL4 Documentation

int OrderSend( string symbol, int cmd, double volume, double price, int slippage, double stoploss, double takeprofit, string comment=NULL, int magic=0, datetime expiration=0, color arrow_color=CLR_NONE)
symbol - Symbol for trading.
cmd - Operation type. It can be any of the Trade operation enumeration.
volume - Number of lots.
price - Preferred price of the trade.
slippage - Maximum price slippage for buy or sell orders.
stoploss - Stop loss level.
takeprofit - Take profit level.
comment - Order comment text. Last part of the comment may be changed by server.
magic - Order magic number. May be used as user defined identifier.
expiration - Order expiration time (for pending orders only).
arrow_color - Color of the opening arrow on the chart. If parameter is missing or has CLR_NONE value opening arrow is not drawn on the chart.

So in our case we have this:
PHP Code:
OrderSend(Symbol(),OP_BUYSTOP,0.1,Ask+30*Point,3,0,0,NULL,1,0);
OrderSend(Symbol(),OP_SELLSTOP,0.1,Bid-25*Point,3,0,0,NULL,1,0); 
That is it!
No stoploss, no takeprofit.
Please note: your broker (most likely) will not accept new orders on 15:30, don't even dream about it. Yes, it will work on demo but not on real account - not any time sooner than 5 minutes before the news and no less than 3 minutes after the news.

Use search engines
Google
Yahoo!
and others.

PS:
if you want me to write an EA for you, PM me.
__________________
MQL4 programming is easy ^^
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #715 (permalink)  
Old 08-04-2007, 10:00 PM
iscuba11's Avatar
Senior Member
 
Join Date: May 2006
Location: Houston
Posts: 399
iscuba11 is on a distinguished road
Smile

You made my day and weekend with the code correction. Thanks ever so much!

May you have a blessed weekend!

Sincerely,

Dave
<><<<
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #716 (permalink)  
Old 08-04-2007, 11:11 PM
iscuba11's Avatar
Senior Member
 
Join Date: May 2006
Location: Houston
Posts: 399
iscuba11 is on a distinguished road
Question

How can use ObjectCreate on an indicator-separate-window versus the chart-window???? This would be handy!

Dave
<><<<
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #717 (permalink)  
Old 08-04-2007, 11:19 PM
iscuba11's Avatar
Senior Member
 
Join Date: May 2006
Location: Houston
Posts: 399
iscuba11 is on a distinguished road
Cool

Quote:
Originally Posted by reiver View Post
I hope someone can help me with something I initially thought would be quite straightforward. I wanted to put an audible alert on an indicator that actually comes with Metatrader so that when it reaches a particular level it will tell me. The indicator is Force Index however I can not find an MQ4 file for it anywhere in the Experts/Indicators folder. Does anyone have an idea where I could locate the file?

If I can find the mq4 file would I be right in assuming I can use the code given by Codersguru at the beginning of this thread to add an alert to it?

thanks
I searched my 2,000 indicators and came up blank also. Maybe you could use the Juice indicator as a substitute???

Dave
<><<<

This Force Index indicator is available from the Meta tradeplateform indicators, but without coding!
Attached Files
File Type: mq4 JuiceLevelsAlertFixedNew.mq4 (4.5 KB, 13 views)

Last edited by iscuba11; 08-04-2007 at 11:40 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #718 (permalink)  
Old 08-05-2007, 12:00 AM
ralph.ronnquist's Avatar
Senior Member
 
Join Date: Oct 2006
Posts: 280
ralph.ronnquist is on a distinguished road
Quote:
Originally Posted by Julia View Post
Okay, here's the deal. For the above code, I want the OrderSend........and the continuing part to create a BuyStop 30 pips above the price at 15:30:00, and a SellStop 25 pips underneath the price at 15:30:00.
I think the terminology is "limit orders"; stop orders are pending orders in reverse to the price movement, and limit orders are pending orders with the price movement. Thus, you'd set a BuyLimit (or SellStop) above the current price and a SellLimit (or BuyStop) below the price. Apart from that, you already have the basic elements.... or maybe someone else wants to assist with actual code.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #719 (permalink)  
Old 08-05-2007, 12:05 AM
SaxMan's Avatar
Member
 
Join Date: Mar 2006
Posts: 27
SaxMan is on a distinguished road
Quote:
Originally Posted by iscuba11 View Post
How can use ObjectCreate on an indicator-separate-window versus the chart-window???? This would be handy!

Dave
<><<<
Hi iscuba11,

All you have to do is:

Code:
ObjectCreate("Object Name",OBJ_LABEL,1,0,0);
The "1" is the first window after "0" - Main chart window. So if you have 3 indicator windows open under the main chart window and you want your object to appear on the third indicator window, you would use a "3" instead of "0".

In this light I often use a "Blank" indicator window to place object labels in and often use these object labels to test my code "Live - as it happens" to confirm that my code is indeed operating correctly and things occur when and how they should.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #720 (permalink)  
Old 08-05-2007, 03:30 AM
Senior Member
 
Join Date: Dec 2006
Location: Ukraine
Posts: 491
Shinigami is on a distinguished road
ralph.ronnquist
SellLimit - sell above the price
BuyLimit - buy below the price

If you don't trust me - try setting a SellLimit below the price and post a picture with such a trade
__________________
MQL4 programming is easy ^^
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks

Tags
histogram, forex, ZUP_v1.mq4

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/questions/270-ask.html
Posted By For Type Date
OzFx System:) - Page 639 This thread Refback 06-21-2008 10:53 PM
Forex SRDC Sidus Sibkis EA MT4 Forum OTCSmart This thread Refback 12-08-2007 12:46 PM


All times are GMT. The time now is 06:19 AM.



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