hallo, I'am new here and in mql4 ;( , but I want to learn and i hope, somebode could help me.
... I tried the hole night , but I didn't find a solution!!! How can I get my iCostum() get running. I want to integrat the DSS Indikator into my EA with iCostum().
"DSS.mq4" is in --> C:\programme\MT4\experts\indicators
Doe's anybody know, were my problem is? Thanks a lot
1. Would you please edit your comment and post your code using SRC button. It will make a lot of easier to read your code.
2. You said you tried this the whole night, where did you tried this : Strategy Tester or live/demo market ?
thank you, phi.nuts.
@ 1. the code
The EA is a litle bit longer. in my question I have tried to limit to the basics, to ask not so complicated. The EA will issue a purchase order, for example, after the DSS indicator in the 5 minutes chart and in the 1 min chart has turned.
@ 2.
I tried this with the strategy Tester with a demoversion in DAX30 market.
Thanks for you help.
... I tried the hole night , but I didn't find a solution!!! How can I get my iCostum() get running. I want to integrat the DSS Indikator into my EA with iCostum().
"DSS.mq4" is in --> C:\programme\MT4\experts\indicators
- Use SRC
- Print out the value and GetLastError() so you find out WHY.
- In the tester, do you have M5 history
- Did you compile DSS.mq4
- See
Detailed explanation of iCustom - MQL4 forum to make your calls readable.
//+------------------------------------------------------------------+ //| DSS-EA.mq4 | //| Copyright 2012, MetaQuotes Software Corp. | //| http://www.metaquotes.net | //+------------------------------------------------------------------+ #property copyright "Copyright 2012, MetaQuotes Software Corp." #property link "http://www.metaquotes.net" extern double TakeProfit = 50; extern double Lots = 1; extern double TrailingStop = 60; extern bool AlertOn = true; datetime alertonce = 0; //+------------------------------------------------------------------+ //| expert initialization function | //+------------------------------------------------------------------+ int init() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| expert deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| expert start function | //+------------------------------------------------------------------+ int start() { double DSS5Current,DSS5Prev; double DSS1Current,DSS1Prev; int cnt, ticket, total; DSS5Current=iCustom(NULL,5,"DSS",false,8,13,0,0); DSS5Prev=iCustom(NULL,5,"DSS",false,8,13,0,1); DSS1Current=iCustom(NULL,1,"DSS",false,8,13,0,0); DSS1Prev=iCustom(NULL,1,"DSS",false,8,13,0,1); total=OrdersTotal(); if(total<1) { if(AccountFreeMargin()<(1000*Lots)) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return(0); } // check for long position (BUY) possibility if (DSS5Current>DSS5Prev && DSS1Current>DSS1Prev) { ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,3,0,Ask+TakeProfit*Point,"DSSsample",12345,0,Green); if(ticket>0) { if ( AlertOn && alertonce != Time[0] ) { if(DSS5Current>DSS5Prev) Alert(Symbol(), " I went long."); alertonce = Time[0]; } } else Print("Error opening BUY order : ",GetLastError()); return(0); } } return(0); } //+------------------------------------------------------------------+
@1. Use SRC
--> I hope I did it right.
I know, it is without SL and not a right TP ... but when I tested the EA from 12. to 19.12.2012, it bought several tims when the DSS turned down in 5 Minutes DAX 30 chart. ... But it shouldn't ;(.
@2. Print out the value and GetLastError() so you find out WHY.
I don't know, what I should do, sorry.
@ 3. In the tester, do you have M5 history
What does this mean. I don't know, what I should do, sorry. I only work in MT4.
@4. Did you compile DSS.mq4
Yes.
@5. See Detailed explanation of iCustom - MQL4 forum to make your calls readable.
I mean, I did it correct ..., but I don't know accectly. Sorry, I dont have so much experiences in MT4-Programming.
I only would have a buy signal if the DSS increases in the 5-min chart and the 1-min chart. Could now anybody help me? Thank you.
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
hallo, I'am new here and in mql4 ;( , but I want to learn and i hope, somebode could help me.
... I tried the hole night , but I didn't find a solution!!! How can I get my iCostum() get running. I want to integrat the DSS Indikator into my EA with iCostum().
"DSS.mq4" is in --> C:\programme\MT4\experts\indicators
Doe's anybody know, were my problem is? Thanks a lot
//--------------------------------
int start()
{
double DSS5Current;
double DSS5Prev;
int cnt, ticket, total;
DSS5Current=iCustom(NULL,5,"DSS",false,8,13, 0, 0);
DSS5Prev=iCustom(NULL,5,"DSS",false,8,13,0, 1);
total=OrdersTotal();
if(total<1)
{
if(AccountFreeMargin()<(1000*Lots))
{
Print("We have no money. Free Margin = ", AccountFreeMargin());
return(0);
}
// check for long position (BUY) possibility
if (DSS5Current>DSS5Prev)
{
ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,3,0,Ask+TakeProfit*Point,"DSSsample",12345,0,Green);
if(ticket>0)
{
if ( AlertOn && alertonce != Time[0] )
{
if(DSS5Current>DSS5Prev)
Alert(Symbol(), " I went long.");
alertonce = Time[0];
}
}
else Print("Error opening BUY order : ",GetLastError());
return(0);
}
return(0);
}
// the end.