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 Thread Tools Display Modes
  #401 (permalink)  
Old 06-23-2008, 04:49 PM
Junior Member
 
Join Date: Nov 2007
Posts: 8
CEHansen is on a distinguished road
How to code this.... (basic question)

Hi all,

I´m trying to get my head around this one, but it seems I´m too stupid.... perhaps you can help.

How do I get an indicator to look for the following thing:

-indicator (for this example I´ll chose Stochastics) has crossed above 50 (or whatever value) and is still above it.

-it has crossed above it not more than (x) bars ago (where x is definable by the user).

I´m pretty new to mt4 programming and I just can´t seem to figure out the logics behind it so I can code it. Any help is greatly appreciated!!!

THANKS!

Chris
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #402 (permalink)  
Old 06-23-2008, 05:19 PM
Administrator
 
Join Date: Sep 2005
Posts: 16,311
Blog Entries: 106
newdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud of
You may use
Current

For example:
Code:
double Buy1_1 = iMA(NULL, 0, 55, 0, MODE_EMA, PRICE_CLOSE, Current + 1);
      double Buy1_2 = iMA(NULL, 0, 200, 0, MODE_EMA, PRICE_CLOSE, Current + 1);
      double Buy2_1 = iMA(NULL, 0, 55, 0, MODE_EMA, PRICE_CLOSE, Current + 0);
      double Buy2_2 = iMA(NULL, 0, 200, 0, MODE_EMA, PRICE_CLOSE, Current + 0);
      double Buy3_1 = iSAR(NULL, 0, 0.005, 0.05, Current + 1);
      double Buy3_2 = iSAR(NULL, 0, 0.005, 0.05, Current + 0);
      double Buy4_1 = iMACD(NULL, 0, 12, 26, 9, PRICE_CLOSE, MODE_SIGNAL, Current + 1);
      double Buy4_2 = iMACD(NULL, 0, 12, 26, 9, PRICE_CLOSE, MODE_SIGNAL, Current + 0);
and so on ..

And in the EA's settings:
Code:
extern int Current = 0;
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #403 (permalink)  
Old 06-24-2008, 01:22 PM
Senior Member
 
Join Date: Sep 2007
Location: Poland
Posts: 232
Pucio is on a distinguished road
Limit & Stop levels

Hi,

Is there indicator that can show my Stop Loss and Take Profit of my Broker when news come ? Indi that can show me changes of Stop Loss and Take Profit ?

Pucio
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #404 (permalink)  
Old 06-24-2008, 01:49 PM
Administrator
 
Join Date: Sep 2005
Posts: 16,311
Blog Entries: 106
newdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud of
I moved your post to here as did not understand the question sorry.
Forex news MT4 indicators are on this section http://www.forex-tsd.com/news-signal-trading/
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #405 (permalink)  
Old 06-24-2008, 10:47 PM
Junior Member
 
Join Date: Nov 2007
Posts: 8
CEHansen is on a distinguished road
Thanks!

much appreciated......
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #406 (permalink)  
Old 06-27-2008, 11:12 AM
xtf xtf is offline
Junior Member
 
Join Date: Jan 2006
Posts: 26
xtf is on a distinguished road
IF statements?

How do you do a simple program with IF statements in MQL4 such as

If price=level 2 then sell.
if price= level 3 then sell
If price= level 1 or level 4, close all trades
restrict trades to 1 per level

with levels set by an indicator or manually


Sorry if this is an impertinent question but it would be good to cut to the chase and avoid learning all the colours, variables, graphics etc etc- just to be able to try out some simple ideas


an example program for the above would be fantastic

thanks
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #407 (permalink)  
Old 07-05-2008, 01:54 PM
Junior Member
 
Join Date: Feb 2006
Posts: 12
nyonk_papua is on a distinguished road
(ASK) Two users are logged in with one account at the same time.

Hi all,
Is it possible, if two users are logged in with one account at the same time when open MT4 software?
Two users have different IP addresses.

Thank you.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #408 (permalink)  
Old 07-14-2008, 01:31 PM
Junior Member
 
Join Date: Jun 2008
Posts: 6
fortsd is on a distinguished road
A question about Stop Order

Hi,
If I place 3 Buy stop orders ( well before hand ), will the broker honour these at times of high volatility or news time?

I am using fxdd and interbank.

Thanks for the answers
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #409 (permalink)  
Old 08-05-2008, 01:41 AM
SVGuss's Avatar
Junior Member
 
Join Date: Feb 2008
Location: Sakhalin Island, Russia
Posts: 23
SVGuss is on a distinguished road
how to automatically close unnecessary locked position?

Hi people!
I've been succesfully trading for the last several months using Ichimoku in conbination with ADX, plus some stochastic configurations to pick up tiny pullbacks.

My problem is that I hate stop losses, and always would rather lock a losing position than close it. Be it good or bad, but it would be nice to have a way to automatically close a locking position should the initial one make money.

Say, I buy EURUSD at 159, set Take Profit at 160, and I put a sell stop at 158.50.
Now, if the TP works, I want Metatrader to cancel the sell stop automatically.
Is such a thing possible?

Thanks a lot
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #410 (permalink)  
Old 08-06-2008, 02:13 AM
Junior Member
 
Join Date: Aug 2007
Posts: 8
dan5767 is on a distinguished road
Stop opening 2 trades per bar

Hello,
Im creating an EA, but orders are opened multiple times per bar. For example if the CCI, in 4H bars, crosses the -100 line I buy. With a 10 pip profit I will close; however, after the close another open will occur in this same bar. How do I stop this?

A member wrote a while ago that Time[x]; x=0,1,2,3.. could be used. Unfortunately, I do not know how to implement this into my ea.

Any help would be greatly appreciated!
Thanks!

PS. Ive tried using this statement, but it does not seem to work.
if (OrdersHistoryTotal()>0 && TimeCurrent() - OrderCloseTime() < 4*3600) {WaitingTime=1;}
else {WaitingTime=0;}
I would use the "WaitingTime==0" in the buy parameters.

Also, a loop might be needed. The above statement is placed before the buy and close portions of the code. I think the OrderCloseTime() is just equaling 0 because the close portion of the code has not been stated before the buy portion. Sorry my programming skills are very weak. Thanks again!

Last edited by dan5767; 08-06-2008 at 02:54 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks

Tags
close, eas, learn mql4 video, profit, reach

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
Learning Cycles For New Traders Dan7974 General Discussion 350 01-18-2008 06:04 PM
Learning to code for autotrading GoatT Metatrader Programming 8 01-10-2007 08:55 PM
Self learning expert mrtools Expert Advisors - Metatrader 4 32 10-22-2006 05:29 PM


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



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