| New signals service! | |
|
|||||||
| 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 |
|
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
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 |
|
|||
|
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 in the EA's settings: Code:
extern int Current = 0; |
|
|||
|
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/ |
|
|||
|
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 |
|
|||
|
(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. |
|
|||
|
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. |
![]() |
| Bookmarks |
| Tags |
| close, eas, learn mql4 video, profit, reach |
| Thread Tools | |
| Display Modes | |
|
|
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 |