Forex



Go Back   Forex Trading > Training > Metatrader > Metatrader 4 mql 4 - Development course > Questions
Forex Forum Register More recent Calendar Advertising Others Help






Register
Welcome to Forex-TSD!, one of the largest Forex forums worldwide, where you will be able to find the most complete and reliable Forex information imaginable.

From the list below, select the forum that you want to visit and register to post, as many times you want. It’s absolutely free. Click here for registering on Forex-TSD.

Exclusive Forum
The Exclusive Forum is the only paid section. Once you subscribe, you will get free access to real cutting-edge Trading Systems (automated and not), Indicators, Signals, Articles, etc., that will help and guide you, in ways that you could only imagine, with your Forex trading.
  • Elite Section
    Get access to private discussions, specialized support, indicators and trading systems reported every week.
  • Advanced Elite Section
    For professional traders, trading system developers and any other member who may need to use and/or convert, the most cutting-edge exclusive indicators and trading systems for MT4 and MT5.
See more

 
 
Thread Tools
 
Old 02-13-2008, 02:45 AM
Senior Member
 
Join Date: Oct 2007
Posts: 230
Dave137 is on a distinguished road
Question Adding & Deleting Indicators

Can a code be written in an EA to add or delete an indicator to the trading platform???

Dave
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
 
Old 02-17-2008, 02:33 PM
Senior Member
 
Join Date: Jan 2006
Posts: 125
metastock is on a distinguished road
I have a big trouble on management of orders....
My simple EA entry at X:59......but i have multiple entry on the same cross. My question: It's possible to check orders time entry and to compare with new order?
I want entry at x:59 only with 1 order for cross....

Someone can help me?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
 
Old 02-18-2008, 07:18 PM
Senior Member
 
Join Date: Jan 2006
Posts: 125
metastock is on a distinguished road
Quote:
Originally Posted by metastock View Post
I have a big trouble on management of orders....
My simple EA entry at X:59......but i have multiple entry on the same cross. My question: It's possible to check orders time entry and to compare with new order?
I want entry at x:59 only with 1 order for cross....

Someone can help me?
This is my solution, I hope this can help someone......

//+------------------------------------------------------------------+
//| Signal Begin(Entry) |
//+------------------------------------------------------------------+

if (Buy1_1 < Buy1_2 && Minute()>58 && check_buy==0) Order = SIGNAL_BUY;
if (Sell1_1 > Sell1_2 && Minute()>58 && check_sell==0) Order = SIGNAL_SELL;
if (Minute()==00) {check_buy=0;}
if (Minute()==00) {check_sell=0;}

//+------------------------------------------------------------------+
//| Signal End |
//+------------------------------------------------------------------+

//Buy
if (Order == SIGNAL_BUY && ((EachTickMode && !TickCheck) || (!EachTickMode && (Bars != BarCount)))) {
//if(!IsTrade) {
//Check free margin
if (AccountFreeMargin() < (1000 * Lots)) {
Print("We have no money. Free Margin = ", AccountFreeMargin());
return(0);
}

if (StopLossMode) StopLossLevel = Ask - StopLoss * Point; else StopLossLevel = 0.0;
if (TakeProfitMode) TakeProfitLevel = Ask + TakeProfit * Point; else TakeProfitLevel = 0.0;
check_buy=1;
Ticket = OrderSend(Symbol(), OP_BUY, Lots, Ask, Slippage, StopLossLevel, TakeProfitLevel, "Buy %W(#" + Magic_Number + ")", Magic_Number, 0, DodgerBlue);
if(Ticket > 0) {
if (OrderSelect(Ticket, SELECT_BY_TICKET, MODE_TRADES)) {
Print("BUY order opened : ", OrderOpenPrice());
if (SignalMail) SendMail("[Signal Alert]", "[" + Symbol() + "] " + DoubleToStr(Ask, Digits) + " Open Buy");
} else {
Print("Error opening BUY order : ", GetLastError());
}
}
if (EachTickMode) TickCheck = True;
if (!EachTickMode) BarCount = Bars;
return(0);
// }
}

//Sell
if (Order == SIGNAL_SELL && ((EachTickMode && !TickCheck) || (!EachTickMode && (Bars != BarCount)))) {
//if(!IsTrade) {
//Check free margin
if (AccountFreeMargin() < (1000 * Lots)) {
Print("We have no money. Free Margin = ", AccountFreeMargin());
return(0);
}

if (StopLossMode) StopLossLevel = Bid + StopLoss * Point; else StopLossLevel = 0.0;
if (TakeProfitMode) TakeProfitLevel = Bid - TakeProfit * Point; else TakeProfitLevel = 0.0;
check_sell=1;
Ticket = OrderSend(Symbol(), OP_SELL, Lots, Bid, Slippage, StopLossLevel, TakeProfitLevel, "Sell %W(#" + Magic_Number + ")", Magic_Number, 0, DeepPink);
if(Ticket > 0) {
if (OrderSelect(Ticket, SELECT_BY_TICKET, MODE_TRADES)) {
Print("SELL order opened : ", OrderOpenPrice());
if (SignalMail) SendMail("[Signal Alert]", "[" + Symbol() + "] " + DoubleToStr(Bid, Digits) + " Open Sell");
} else {
Print("Error opening SELL order : ", GetLastError());
}
}
if (EachTickMode) TickCheck = True;
if (!EachTickMode) BarCount = Bars;
return(0);
//}
}

if (!EachTickMode) BarCount = Bars;

return(0);
}
//+------------------------------------------------------------------+
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
 
Old 02-24-2008, 01:18 AM
Member
 
Join Date: Oct 2006
Posts: 80
Big Be is on a distinguished road
To Metastock

I can't tell what causes check_buy to be True.
To limit to one order open, you can use, before entry:
if (OrdersTotal()==0)

Big Be
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
 
Old 02-24-2008, 01:19 AM
Member
 
Join Date: Oct 2006
Posts: 80
Big Be is on a distinguished road
Coding Knowledge Questions

WHEN do you want to use a STATIC variable - what problems can it solve?

WHEN do you want to put something in the INIT() section - what problems does it solve?

Big Be
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
 
Old 02-24-2008, 05:47 AM
Junior Member
 
Join Date: Feb 2008
Posts: 3
longng12 is on a distinguished road
not sure if this has been asked befor, but is there a way to draw a line at the current time +1 hr befor and after at a certain price in an EA?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
 
Old 02-24-2008, 09:58 AM
ralph.ronnquist's Avatar
Senior Member
 
Join Date: Oct 2006
Posts: 297
ralph.ronnquist is on a distinguished road
Quote:
Originally Posted by Big Be View Post
WHEN do you want to use a STATIC variable - what problems can it solve?

WHEN do you want to put something in the INIT() section - what problems does it solve?

Big Be
So, an answer to this, is that instead of, or in addition to, the explanations in the MQ4 documentation?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
 
Old 02-24-2008, 04:32 PM
Junior Member
 
Join Date: Jan 2008
Posts: 24
SimonF is on a distinguished road
How to keep track of multiple orders?

I'm currently making an EA that only has 1 open trade at a time.
I have alot of variables to keep track of what is happening during this trade.
If I had more open trades at the same time I thought I could use arrays for these variables with the ticket number as key. But as I understand it the keys has to be 0,1,2,3 etc right? So this wouldn't be possible.

Instead of that I could have a multidimension array like this, I hope you understand my javascript/php like description.
barsSinceOpen = array(
0 => array(0 => 123123, 1 => 63)
1 => array(0 => 552352, 1 => 5)
);
0 in second dimension would be ticket number, and 1 would be amount of bars since the trade was open.
barSinceOpen is just an example.. I know I could calculate this one out for each trade every time I want, but that's not the point. I have ALOT of things I keep track of for a trade.

And to select the correct order I would have to iterate over the array and select the 2nd level array with correct ticket.

Do you think this is a good idea? How would you do it?
__________________
boo
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
 
Old 02-24-2008, 04:55 PM
Junior Member
 
Join Date: Jan 2008
Posts: 24
SimonF is on a distinguished road
Another question

It seems like when I do a orderModify() to set a take profit for example.
And then before next tick or we could aswell say before I select the same order again I do another orderModify() to set a stop loss. And in that I use OrderTakeProfit() so it doesn't remove the take profit. But, It removes the take profit anyway.
Do I need to wait for next tick or to select the order again for the OrderTakeProfit() to return my new take profit?
__________________
boo
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
 
Old 02-24-2008, 05:46 PM
Member
 
Join Date: Oct 2006
Posts: 80
Big Be is on a distinguished road
re: Coding Knowledge Questions

Quote:
Originally Posted by Big Be View Post
WHEN do you want to use a STATIC variable - what problems can it solve?

WHEN do you want to put something in the INIT() section - what problems does it solve?

Big Be


Quote:
Originally Posted by ralph.ronnquist View Post
So, an answer to this, is that instead of, or in addition to, the explanations in the MQ4 documentation?
That would be in addition.
(I always try to do my homework first.)
Maybe I need explanation and example(s).

Big Be

Last edited by Big Be; 02-24-2008 at 06:08 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
 

Bookmarks

Tags
forex, histogram, JMASlope, ToR 1.20, ZUP_v1.mq4
Thread Tools

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


All times are GMT. The time now is 12:36 AM.



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