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
  #1151 (permalink)  
Old 06-11-2008, 05:47 PM
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
Here's why I wanted to know:

TRO Indicators
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1152 (permalink)  
Old 06-11-2008, 07:16 PM
Junior Member
 
Join Date: Jun 2008
Posts: 2
ColeFlournoy is on a distinguished road
Hi,

First off thank you in advance for you help!
I am trying to see if there is a way to use multiple threads in an expert advisor like you can in c++.

The reason is, I do news trading and I need to have several orders all send at the same time. For example, I need to place 3 orders GBP/USD, USD/CAD, EUR/USD as soon as the data comes in. Now my problem is that if I use the regular order send function 3 times, it is slow, as it sends the orders incrementally, not at the same time.

OrderSend("GBPUSD",OP_BUY,0.01,ask,5,ask-25*point,ask+25*point,"Cole",11111,0,Red);
OrderSend("USDCAD",OP_BUY,0.01,ask,5,ask-25*point,ask+25*point,"Cole",11111,0,Red);
OrderSend("EURUSD",OP_BUY,0.01,ask,5,ask-25*point,ask+25*point,"Cole",11111,0,Red);

I am sure this can be done somehow because If I open up 3 separate MT4 buy/sell windows and click them all at the same time (using a news trading program), the orders all send at the same moment and come in much faster. When you do it this way, the orders all pop up at once, as opposed to using my EA with 3 OrderSend calls, they pop up one after another.

Is there any way to setup multiple running threads in an EA, or perhaps is there some type of batch OrderSend?

Thanks!
Cole
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1153 (permalink)  
Old 06-12-2008, 02:11 AM
Senior Member
 
Join Date: Feb 2007
Posts: 947
FerruFx is on a distinguished road
Quote:
Originally Posted by ColeFlournoy View Post
Hi,

First off thank you in advance for you help!
I am trying to see if there is a way to use multiple threads in an expert advisor like you can in c++.

The reason is, I do news trading and I need to have several orders all send at the same time. For example, I need to place 3 orders GBP/USD, USD/CAD, EUR/USD as soon as the data comes in. Now my problem is that if I use the regular order send function 3 times, it is slow, as it sends the orders incrementally, not at the same time.

OrderSend("GBPUSD",OP_BUY,0.01,ask,5,ask-25*point,ask+25*point,"Cole",11111,0,Red);
OrderSend("USDCAD",OP_BUY,0.01,ask,5,ask-25*point,ask+25*point,"Cole",11111,0,Red);
OrderSend("EURUSD",OP_BUY,0.01,ask,5,ask-25*point,ask+25*point,"Cole",11111,0,Red);

I am sure this can be done somehow because If I open up 3 separate MT4 buy/sell windows and click them all at the same time (using a news trading program), the orders all send at the same moment and come in much faster. When you do it this way, the orders all pop up at once, as opposed to using my EA with 3 OrderSend calls, they pop up one after another.

Is there any way to setup multiple running threads in an EA, or perhaps is there some type of batch OrderSend?

Thanks!
Cole
In anyway, your platform won't send multiple orders at the exact same time.

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1154 (permalink)  
Old 06-12-2008, 01:49 PM
Junior Member
 
Join Date: Jun 2008
Posts: 2
ColeFlournoy is on a distinguished road
FerruFX -- I'm not sure I understand what you are saying?

Thanks,
Cole
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1155 (permalink)  
Old 06-12-2008, 04:19 PM
Junior Member
 
Join Date: Oct 2006
Posts: 12
forexcel is on a distinguished road
Quote:
Originally Posted by IN10TION View Post
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?

...
Hi IN10TION,

Here is the code i am using (not my code) to find the inside bar.

}


int IsInsideBar(int shift) {
//Inside Bar, The close of the inside bar should be higher than both the close and the bar midpoint The current bar must open
//equal or higher than the close of the inside bar a BuyStop order is to be placed at the high of the inside bar if the order
//is not hit within the next 4 bars cancel order. See picture below
if (High[shift]>High[shift+1]) return(0);
if (Low[shift]<Low[shift+1]) return(0);
if (Close[shift]>Open[shift] && Close[shift]>(High[shift]+Low[shift])/2 && Open[shift-1]>=Close[shift]) return(1);
if (Close[shift]<Open[shift] && Close[shift]<(High[shift]+Low[shift])/2 && Open[shift-1]<=Close[shift]) return(-1);
return(false);
}


Now, my question is:

If I want to place a buy-stop and a sell-stop at the high and low of the next bar, the bar following the inside bar...what would the code be?

Thanks for the help...

forexcel
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1156 (permalink)  
Old 06-12-2008, 10:17 PM
Beno's Avatar
Senior Member
 
Join Date: Aug 2006
Location: London
Posts: 361
Beno is on a distinguished road
Quote:
Originally Posted by IN10TION View Post
I'm all ears, you can send me a private message or bring it in the open...
if your indicators are well coded your finishing EA is not so far away.
Gidday In10tion

Attached is the pic of what I am trading.

I use these 4 indicators
Sell signal
1: Slow Stochastic K% Crossed D% over 80 and vice versa for Buy below 20
2: QQE RSI Crossed below ATR and vice versa for Buy
3: CCI Crosses below 0 and vice versa for Buy
4: MACD ma's crossed and 1 bar formed below 0 and vice versa for Buy

If any 3 of these conditions are met then open a position eg stoch fire signal 5 mins later MACD then 20min CCI fires signal = open position.

or any conbinations of the above as long as they are in the same direction as the Slope indicator.

Screen shot attached

Regards
Attached Images
File Type: gif bones.gif (53.8 KB, 136 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1157 (permalink)  
Old 06-12-2008, 10:49 PM
Junior Member
 
Join Date: Aug 2007
Posts: 5
Matrix 78 is on a distinguished road
Hola

i want to close my position only if i'm in gain is this possible?

where i wrong?
Code:
for(cnt=0;cnt<total;cnt++)
     {
      //Seleziono quell'ordine
      OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
      if(OrderType()<=OP_SELL &&   // check for opened position
         OrderSymbol()==Symbol())  // check for symbol
        {
          if(OrderType()==OP_BUY)   // long position is opened
           {
            if(OrderProfit() > 0,64$
             {
               if ( ... = true)
                   {
                   priceclose=OrderOpenClose;
                   OrderClose(OrderTicket(),OrderLots(),Bid,3,Violet); // close position
                   lastgainl=OrderProfit();
                   lastclodeprice=OrderClosePrice();
         //close my position
There is any Onlineinformation when i use a parameter like Help or other thing in metaeditor maybe push F12 and i can see the info about parameter like other debugger on C compilator?

Question:

-Is possible to have the gain in pip?like 50 pip and not in $?

-How i close the position only is in gain?

-Why if i print in comment "lastclosedprice" i can't see nothing?


Part 2

I want to take a long/short only just prime on current time frame break 40 EMA

And if cross the price don't close so far like max 10/12 pip if not i put a limit order at moving avrege price
Code:
if(long==0 &&  LastClosedBar != Time[0]  && Ask >= MA_40  && minprevius <= MA_40 && maxprevius >= MA_40)
// so entry long is right???Thanks for Help
Beacuse this sistem not cath all entry conditions
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1158 (permalink)  
Old 06-13-2008, 10:55 AM
sonicdeejay's Avatar
Member
 
Join Date: Apr 2008
Posts: 98
sonicdeejay is on a distinguished road


As you can see from the pic.

According to the rules,

AC>0 && RSI>50 BUY

AC<0&&RSI<50 SELL

The indicator suppose to tigger BUY signals @ line 1,line 2 and line 3.....

but due to my limiting in coding of metatrader,It only trigger at line 1.

I do not know how to program the indicator to trigger another BUY signals @ line 2 and 3...I have some coding issue in looping...

Please Help me out!!!

I attach the same v2.11 beta indicator..
Attached Files
File Type: mq4 Sonic_Ind_v2.11Beta.mq4 (7.1 KB, 11 views)
__________________
~It's not who I am underneath but, what I do that defines me!!

My FOREX Journal
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1159 (permalink)  
Old 06-13-2008, 12:06 PM
Senior Member
 
Join Date: Nov 2006
Posts: 122
Yoda_Glenn is on a distinguished road
I was wondering if it might be possible to take two types of code and combine them. I need to take the money management system (MM) from a martiangle EA, and apply it to a "Close ALL Profit Loss" EA. I am trying to get the "Close ALL Profit Loss EA" to adjust its closing profit value according to my ever growing balance. Right now I have to manually adjust my "Close ALL Profit EA" profit-goal settings according to my ever changing balance. If this is too complicated for a free-answer, then I understand.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1160 (permalink)  
Old 06-14-2008, 02:41 AM
sonicdeejay's Avatar
Member
 
Join Date: Apr 2008
Posts: 98
sonicdeejay is on a distinguished road
Quote:
Originally Posted by sonicdeejay View Post


As you can see from the pic.

According to the rules,

AC>0 && RSI>50 BUY

AC<0&&RSI<50 SELL

The indicator suppose to tigger BUY signals @ line 1,line 2 and line 3.....

but due to my limiting in coding of metatrader,It only trigger at line 1.

I do not know how to program the indicator to trigger another BUY signals @ line 2 and 3...I have some coding issue in looping...

Please Help me out!!!

I attach the same v2.11 beta indicator..
someone nice has help me solved this...

Forex Factory - View Single Post - Sonic Indicator Project!!


sonic
__________________
~It's not who I am underneath but, what I do that defines me!!

My FOREX Journal
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:22 AM.



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