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
  #1141 (permalink)  
Old 06-09-2008, 03:42 PM
IN10TION's Avatar
Senior Member
 
Join Date: Mar 2007
Posts: 569
Blog Entries: 1
IN10TION is on a distinguished road
so you want to take bar price values before or after a doji/inside bar, this doji/inside bar has to be formed first, otherwise you don't know if there is a doji/inside bar, so the next bar after the doji/inside bar has to be the current bar where you place your buy or sell orders, pending or not...

but you want to take price values before the doji/inside bar?
if it's after... you have to wait few bars longer, after the doji/inside bar...

something is not logic about that...
think I need more input

Quote:
Originally Posted by forexcel View Post
Hello All :

I am not a programmer but i am learning to make my own ea. I want my ea to trade based on the INSIDE BAR and the DOJI BAR.

My questions :
1 : If I want to place a buy-stop and/ or a sell stop at the close of 2 bars BEFORE the doji and/or the inside bar, how do i code it ?
2 : If I want to place a buy-stop and/ or a sell stop at the close of the second or third bar AFTER the doji and/or the inside bar, how do i code it ?

Any help will be greatly appreciated !

I thank you in advance…

Regards,

forexcel
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1142 (permalink)  
Old 06-09-2008, 04:02 PM
Junior Member
 
Join Date: Oct 2006
Posts: 12
forexcel is on a distinguished road
Hello IN10TION,

Yes, after the formation of the doji or inside bar, i want to be able to go 1, 2 or 3 bars before such doji or inside bar and place a buy-stop or a sell-stop.
In addidion, if i want to wait 1, 2 , or 3 bars after the formation...Let me explain that part further: Let's say we have an Inside bar at the close the 10 AM bar. Now i want to take the high or the low of the 12 PM (2 bars later) and place buy-stop or sell stop at 1:01 PM.

Hope i was clear. Should you need me to explain it further, please do not hesitate to ask.
Thanks for the help.

Forexcel

Quote:
Originally Posted by IN10TION View Post
so you want to take bar price values before or after a doji/inside bar, this doji/inside bar has to be formed first, otherwise you don't know if there is a doji/inside bar, so the next bar after the doji/inside bar has to be the current bar where you place your buy or sell orders, pending or not...

but you want to take price values before the doji/inside bar?
if it's after... you have to wait few bars longer, after the doji/inside bar...

something is not logic about that...
think I need more input
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1143 (permalink)  
Old 06-10-2008, 02:58 PM
IN10TION's Avatar
Senior Member
 
Join Date: Mar 2007
Posts: 569
Blog Entries: 1
IN10TION is on a distinguished road
Do you already have some code for this, that you started?
in a mq4 file?

the first thing you need is confirmation doji/inside = yes or no
depending on your settings it will look before the doji/inside or wait
when it waits 2 bars it has to decide the orders, depending on the previous bar high or low...

well you can start programming
you have some code to find the doji's or insiders?

...

Quote:
Originally Posted by forexcel View Post
Hello IN10TION,

Yes, after the formation of the doji or inside bar, i want to be able to go 1, 2 or 3 bars before such doji or inside bar and place a buy-stop or a sell-stop.
In addidion, if i want to wait 1, 2 , or 3 bars after the formation...Let me explain that part further: Let's say we have an Inside bar at the close the 10 AM bar. Now i want to take the high or the low of the 12 PM (2 bars later) and place buy-stop or sell stop at 1:01 PM.

Hope i was clear. Should you need me to explain it further, please do not hesitate to ask.
Thanks for the help.

Forexcel
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1144 (permalink)  
Old 06-10-2008, 09:14 PM
cutzpr's Avatar
Member
 
Join Date: Jan 2008
Posts: 50
cutzpr is on a distinguished road
EA opening too many orders

What different methods can be used to stop an EA from opening so many multiple positions back to back. I am thinking of adding a sleep function but I wouldnt want to miss out on any trades that could have taken please during the EA was in sleep.
Attached Images
File Type: jpg Multi-order.JPG (114.9 KB, 112 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1145 (permalink)  
Old 06-10-2008, 10:46 PM
IN10TION's Avatar
Senior Member
 
Join Date: Mar 2007
Posts: 569
Blog Entries: 1
IN10TION is on a distinguished road
if you see that all buys and sells are at the right place, and don't do anything drastically wrong, you then can find another filter, to have a more to the point buy or sell choice... let your EA test run on a visual chart and put also some different indicators on it, and see of those indicators can help you filter out those over orderings. Use a simple stochastic, or change the time period with it, adjust the stochastic values... try RSI, CCI. Stay with the same currency pair that you trust. Every pair has her setting and difficulty. Keep it simple.

Quote:
Originally Posted by cutzpr View Post
What different methods can be used to stop an EA from opening so many multiple positions back to back. I am thinking of adding a sleep function but I wouldnt want to miss out on any trades that could have taken please during the EA was in sleep.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1146 (permalink)  
Old 06-11-2008, 03:21 AM
TheRumpledOne's Avatar
Banned
 
Join Date: Nov 2006
Posts: 802
TheRumpledOne is an unknown quantity at this point
Quote:
Originally Posted by IN10TION View Post
iBarShift will find for you the bar that start on that day or also the end bar for that day.

int iBarShift( string symbol, int timeframe, datetime time, bool exact=false)

next...

use those bar positions to find the results of iHighest and iLowest

int iHighest( string symbol, int timeframe, int type, int count=WHOLE_ARRAY, int start=0)
int iLowest( string symbol, int timeframe, int type, int count=WHOLE_ARRAY, int start=0)


results & done

Code:
   int   yy  = TimeYear(Time[0]);
   int   mm = TimeMonth(Time[0]);
   int   dd  = TimeDay(Time[0]);
      
   datetime var1;
     
   string yymmddms = yy+"."+mm+"."+dd+" 00:00" ;
         
   var1 = StrToTime(yymmddms);
  
   int shift =i BarShift(NULL,0,var1,false);   
           
   int hh = Highest(NULL,0,MODE_HIGH,shift,0);
   int ll   = Lowest(NULL,0,MODE_LOW,shift,0); 
      
   double xRES = iHigh(NULL,0,hh) ;  
   double xSUP = iLow(NULL,0,ll) ;
Is there a simpler way to find the bar number of today's high and low?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1147 (permalink)  
Old 06-11-2008, 03:53 AM
Senior Member
 
Join Date: Feb 2007
Posts: 947
FerruFx is on a distinguished road
Quote:
Originally Posted by TheRumpledOne View Post
Is there a simpler way to find the bar number of today's high and low?
today_high = High[0];
today_low_ = Low[0];

Find the bar number for today ??? The 0 mean today. On D1 of course.

If you are on other TF:

today_high = iHigh(Symbol(),PERIOD_D1,0);
today_low = iLow(Symbol(),PERIOD_D1,0);


FerruFx
__________________
THE HEART of FOREX & THE PROBABILITY METER - Trade with 100% confidence and ... Stress Less!!!
Coding services: Experts Advisors, indicators, alerts, etc ... more info by PM
NEW: video presentation of the Probability Meter ... 24hrs action on the website

Last edited by FerruFx; 06-11-2008 at 03:57 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1148 (permalink)  
Old 06-11-2008, 04:46 AM
IN10TION's Avatar
Senior Member
 
Join Date: Mar 2007
Posts: 569
Blog Entries: 1
IN10TION is on a distinguished road
Quote:
Originally Posted by TheRumpledOne View Post
I would like to know what bar the highest high and lowest low occurred for today on H1 or less time periods.

I know I can use a for loop and check.

Is there a more elegant way to do this?

Is there a first bar of today function?

Thanks.
datetime some_time_start_day=D'0000.00.00 00:00';
datetime some_time_end_day=D'0000.00.00 00:00';
int shiftStart=iBarShift(NULL,PERIOD_M1,some_time_star t_day);
int shiftEnd=iBarShift(NULL,PERIOD_M1,some_time_end_da y);

double valH=High[iHighest(NULL,0,MODE_HIGH,shiftStart-shiftEnd+1,shiftEnd)];
double valL=Low[iLowest(NULL,0,MODE_LOW,shiftStart-shiftEnd+1,shiftEnd)];



nothing simpler then this...
ps. I thought the question was find the bars on a lower timeframe, otherwise just do what FerruFx explained take from D1

.
__________________
..4.Nov.08.. IN10TION newsReader v09.85 Lite - the best news reader on your chart

Last edited by IN10TION; 06-11-2008 at 04:53 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1149 (permalink)  
Old 06-11-2008, 05:43 AM
hermanto's Avatar
Junior Member
 
Join Date: Apr 2008
Posts: 6
hermanto is on a distinguished road
Dear codersguru,

I need ea that should be piece of cake for you,
it close all open positions (for certain pair) when 2 MA crossed.
Off course, if faster MA crossed down slower MA it close long position,
vice versa.
Variabels :
- Faster MA type
- Faster MA value
- Slower MA type
- Slower MA value
- TimeFrame (we can fixed the timeframe without being interferred
when we switching between timeframe graph windows)

I have tried to modified MA crossed EA, but always failed.

Thank you for your kindness.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1150 (permalink)  
Old 06-11-2008, 06:06 AM
TheRumpledOne's Avatar
Banned
 
Join Date: Nov 2006
Posts: 802
TheRumpledOne is an unknown quantity at this point
Quote:
Originally Posted by IN10TION View Post
datetime some_time_start_day=D'0000.00.00 00:00';
datetime some_time_end_day=D'0000.00.00 00:00';
int shiftStart=iBarShift(NULL,PERIOD_M1,some_time_star t_day);
int shiftEnd=iBarShift(NULL,PERIOD_M1,some_time_end_da y);

double valH=High[iHighest(NULL,0,MODE_HIGH,shiftStart-shiftEnd+1,shiftEnd)];
double valL=Low[iLowest(NULL,0,MODE_LOW,shiftStart-shiftEnd+1,shiftEnd)];



nothing simpler then this...
ps. I thought the question was find the bars on a lower timeframe, otherwise just do what FerruFx explained take from D1

.
Thanks.

I guess there isn't a simpler way.

I thought there might be a keyword/reserved word for BarStartOfDay or something.
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:24 AM.



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