| 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 (1) | Thread Tools | Display Modes |
|
|||
|
i have created a really simple EA. and a system which i use in atleast 3 Timeframe..May problem it doesn't stop opening and i don't want to have 3 EA and 3 chart for one pair.
i need a code that would only do one order for buy and for sell per bar per TF and still open if it is on a different bar. i can have buy and sell and the same bar. Sometimes i have 3 signal in 3 different TF. i want to take all order but i want only one order per TF and i can still take another order in another TF if it is still open but in a different bar. example: 1 signal in 4h 1 signal in 1h but it falls in bar for 4h 1 signal in 30 min but only one bar for 1h and 4h. 3 signal will be open. i am ok with using magic number as means of filter. can someone help me? thank you very much. so far this is what i thought: for 30 mins if (magicnumber == 123) { if (iTime(OrderOpenTime()) != iTime(Symbol(),PERIOD_M30,0)) {//my order code} } i don't have MT4 but i know somethings is not right in the logic or code. So guys please help me. also i think we have similar problem with matrixebiz |
|
||||
|
Quote:
Remove this two lines: #property indicator_minimum 0 #property indicator_maximum 100 Levels only works fine on bounded indicators but to do a bounded indicator the calculation must include the limits. Example: RSI = 100-(100/(1+U/D)) We know by that formula that the indicator will move between 0-100 and because that we could include 70-30 levels without fear to they would disappear. Another example is MACD = EMA(CLOSE, 12)-EMA(CLOSE, 26)). We set a level on M5 and when we move to H1 most probable is the level has gone. So, we take the same formula and we make some changes MACD = (EMA(CLOSE, 12)-EMA(CLOSE, 26))/EMA(CLOSE, 26). And now we have a percent indicator. Is not bounded but we have less probabilities to lost our levels.
__________________
|
|
|||
|
Quote:
|
|
||||
|
This is just the example (because now you have the Oscillator HMA
) from previous post, still it's MACD but calculated on a different way.
__________________
Last edited by Linuxser; 08-18-2008 at 04:09 PM. |
|
|||
|
Whatīs wrong with this indicator?
Hereīs one that is probably very simple to figure out but Iīm relatively new to this and have no clue how to solve the problem.
This indicator compiles without problems but thereīs nothing showing up on the charts. Iīm sure some of you more experienced programmers might see quickly where I made a mistake. Any help is greatly appreciated. The indicator should draw an arrow on the charts when certain criteria are met... I wrote the explanations into the code, that makes it easier to follow... I attached the mq4 file... i have not been able to insert the code into this box without making it look really messy .....Iīd be thrilled if anyone can help me with it... THANKS GUYS! CEH P.S. perhaps you can figure out how to insert the code into the message box and then comment on it, that way more people can learn from it... |
|
||||
|
is there anyone know the code to ask the EA start open trade when the new bar start in D1 time frame ??
here is the logic: in D1 TF, when the new candle (it's mean a new day) is start then EA will open 2 position, BUY and SELL with TP=10 pips for each position. When the candle closed then EA close all position and start opening position again for the new candle. very simple rule, but still I cann't find the code for this simple rule.... ![]() I'm realy new in MQL4 coding and already search and read many source and forum to learn more about MQL4 coding, but cann't find what I'm need. Thanks before... |
|
||||
|
here is my code.... please help me to fix it
I tried to code what I have ask before, here is the sample EA code:
Quote:
btw, I attached it here too |
|
|||
|
code...
hereīs the code, thought it wouldnīt fit in here but when I pressed "preview post" it all looked neat.....
I canīt figure out why there arenīt any arrows showing up on the chart... probably just a simple mistake... # //+------------------------------------------------------------------+ //| George.mq4 | //| Copyright Đ 2008, CEH | //| | //+------------------------------------------------------------------+ #property copyright "Copyright Đ 2008, CEH" #property link "" #property indicator_chart_window #property indicator_buffers 1 #property indicator_color1 Green extern int Trend_Period = 100; //period of overall trend indicator extern int Trend_Mode = 1; //0=sma, 1=ema, 2=smma, 3=lwma, 4=lsma extern int Trend_Shift = 0; //shift of overall trend indicator extern int Sto_Lookback = 3; //lookback period for stochastic indicator double buyit[]; int Current = 0; bool triggup, trendup, stochup, sloppystochup; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators SetIndexStyle(0, DRAW_ARROW, EMPTY, 3); SetIndexArrow(0, 233); SetIndexBuffer(0, buyit); //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int Current = 0; int i = 0; //this is intended to create a lookback period where the program finds out if //there was a certain condition within "i" bars... for (i = 1; i <= Sto_Lookback; i++) { //overall trend indicator... now and previous to calculate direction itīs going double trend_ma_now = iMA(NULL, 0, Trend_Period, Trend_Shift, Trend_Mode, PRICE_CLOSE, Current + 1); double trend_ma_pre = iMA(NULL, 0, Trend_Period, Trend_Shift, Trend_Mode, PRICE_CLOSE, Current + 2); //triggerline... now and previous to calculate if it was crossed double trigg_ma_now = iMA(NULL, 0, 5, 1, MODE_EMA, PRICE_CLOSE, Current + 1); double trigg_ma_pre = iMA(NULL, 0, 5, 1, MODE_EMA, PRICE_CLOSE, Current + 2); //short stochastics... now and previous to calculate which direction it is moving double sto_short_now = iStochastic(NULL, 0, 8, 3, 3, MODE_SMA, 0, MODE_MAIN, Current + 1); double sto_short_pre = iStochastic(NULL, 0, 8, 3, 3, MODE_SMA, 0, MODE_MAIN, Current + 2); //long stochastics double sto_long_now = iStochastic(NULL, 0, 36, 3, 3, MODE_SMA, 0, MODE_MAIN, Current +1); //short stochastics value at "i" double sto_short = iStochastic(NULL, 0, 8, 3, 3, MODE_SMA, 0, MODE_MAIN, i); //long stochastics value at "i" double sto_long = iStochastic(NULL, 0, 36, 3, 3, MODE_SMA, 0, MODE_MAIN, i); //if last bar closed above overall trend and trendline moves up then trendup is true if (Close[Current + 1] > trend_ma_now && trend_ma_now > trend_ma_pre) {trendup = true;} //if last bar closed above triggerline while closing below/at it the bar before (a cross up) then triggup is true if (Close[Current +1] > trigg_ma_now && Close[Current +2] <= trigg_ma_pre) {triggup = true;} //if short stochastics move up... and both short and long stochastics //have both been below 25 anywhere within the last "i" bars then stochup is true if (sto_short_now > sto_short_pre && sto_short <= 25 && sto_long <= 25) {stochup = true;} //if short stochastics move up... and anywhere within "i" bars short stochastics have been //at least 10 points lower than long stochastics... and long stochastics are still above 35.. //then sloppystochup is true if (sto_short_now > sto_short_pre && sto_short + 10 <= sto_long && sto_long_now > 35) {sloppystochup = true;} //if triggup, trendup and stochup are all true.. OR... triggup, trendup and sloppystochup are all true... if (triggup == true && trendup == true && stochup == true || triggup == true && trendup == true && sloppystochup == true) //then draw an arrow below the low of the last closed candle... {buyit[Current + 1] = Low[Current + 1];} } //---- return(0); } # Last edited by CEHansen; 08-20-2008 at 11:55 AM. |
![]() |
| Bookmarks |
| Tags |
| candle time, CHinGsMAroonCLK, coders guru, expert advisor, forex, how to code, I_XO_A_H, mechanical trading, trading |
| Thread Tools | |
| Display Modes | |
|
|
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 07: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 05:22 PM |