Forex
Google
New signals service!

Go Back   Forex Trading > Programming > Metatrader Programming


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 Thread Tools Display Modes
  #151 (permalink)  
Old 07-30-2007, 05:15 PM
mladen's Avatar
Senior Member
 
Join Date: Oct 2006
Posts: 332
mladen is on a distinguished road
I do not know what do you need it for, but here you go

Last edited by mladen; 07-21-2008 at 05:41 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #152 (permalink)  
Old 07-31-2007, 02:10 AM
Member
 
Join Date: Jul 2007
Posts: 41
MQL4 is on a distinguished road
Exclamation To All Coders

Hello fellow coders!!!

I have HUGE PROBLEMS FOR > 10 DAYS!!

1) First problem :
extern double StartHour, StartMinute;
extern double line;


int start()
{
//----
if (TimeHour (TimeCurrent()) == StartHour)
{
if (TimeMinute (TimeCurrent()) == StartMinute)
{
line = Bid;
Print ("Newer ", "line is ", line, "Bid is ", Bid);
//if (Bid > line + 12* Point) //LINE 1
//{
//Print ("The bid is 12 points bigger then the previous bid");
//} //LINE 4
}
}
//----
return(0);
}

The program was printing “Newer” until LINE 1 - LINE 4 were added.
After this, I ran the program again, the inputs were loaded, it was initialized, and no any printing.
Then, LINE1-LINE4 were blocked with // and again no printing.
What is the problem?

2) Second problem :
Other programs during 1 week were working and then suddenly stopped working. Nothing was changed.
Again, I created a new program of the same type. And, again it works for a certain period of time and then stops working. All the time, the program becomes dead after a short period of time. No output printing, nothing!!!
What is this????

3) Third problem :
Another problem for the previous week., a program was coded. I ran the program and the output said, for example, “A” printing. I deleted Print (“A”) code; and typed instead Print (“B”); but on the program run it was printing A. I do compiling after any change in the coding.

I suspect that someone purposely gave me a certain code that sets a bug to every new EA that I create!!!!!!!!!!!!!
They do this on purpose that at the end to ask for money that I don’t have.

Is there any other way to solve the problem except formatting the hard drive?
Please, HELP!!!!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #153 (permalink)  
Old 07-31-2007, 02:16 AM
Member
 
Join Date: Jul 2007
Posts: 41
MQL4 is on a distinguished road
Thank You Mladen!!!!!!!!!!!!!!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #154 (permalink)  
Old 07-31-2007, 02:18 AM
Member
 
Join Date: Jul 2007
Posts: 41
MQL4 is on a distinguished road
I have some questions, if You don't mind coders....

PHP Code:
int start() 
  { 
   
double haHighhaLow
   
string date;

   
ExtCountedBars=IndicatorCounted(); 
      if (
ExtCountedBars<0) return(-1); 
      if (
ExtCountedBars>0ExtCountedBars--; 
      
   
int i=Bars-ExtCountedBars-1
   while(
i>=0
     { 
      
haHigh=High[i]; 
      
haLow=Low[i];
      if ((
TimeHour(iTime(NULL,0,i))==22 &&  TimeMinute(iTime(NULL,0,i))==55) ||
          (
TimeHour(iTime(NULL,0,i))==16 &&  TimeMinute(iTime(NULL,0,i))==30))
        { 
         
ExtMapBuffer1[i]=haHigh
         
ExtMapBuffer2[i]=haLow
        }  
      else 
        { 
         
ExtMapBuffer1[i]=haLow
         
ExtMapBuffer2[i]=haHigh
        }  
        
i--; 
     } 
//---- 
   
return(0); 
  } 
//+------------------------------------------------------------------+ 


Can You please just do the //comments, and PLEASE explain each line for me please, I want to be able to understand each line
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #155 (permalink)  
Old 07-31-2007, 10:23 AM
Senior Member
 
Join Date: Feb 2006
Posts: 558
Michel is on a distinguished road
Quote:
Originally Posted by MQL4 View Post
I suspect that someone purposely gave me a certain code that sets a bug to every new EA that I create!!!!!!!!!!!!!
They do this on purpose that at the end to ask for money that I don’t have.
Don't be so paranoiac ! Your code is just full of mistake comming from your lack of knowledge.
My advise is that for every word you write, check the help file of Mql4 (you must know, it's your name ...)
For sample :
"extern double StartHour, StartMinute;
...
if (TimeHour (TimeCurrent()) == StartHour)"

Mql4 : int TimeHour( datetime time)
Returns the hour for the specified time.

you compare a double with an int, this doesn't work, you have to declare StartHour as int.

If you have the assignation statement "line = Bid;", your imediatelly following test "if (Bid > line + 12* Point)" will never be true.

in place of "TimeHour (TimeCurrent())" you can also use "Hour()"

So "Is there any other way to solve the problem except formatting the hard drive?"
Yes, just learn a little bit more.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #156 (permalink)  
Old 07-31-2007, 05:06 PM
Member
 
Join Date: Jul 2007
Posts: 41
MQL4 is on a distinguished road
Thank You Michel,
I agree with You. Also,
I modified everything, can You please check it, and change mistakes???

At 12:30 it is to set a buystop 10 pips above the current price, and set a sellstop 10 pips below the current pirce.

PHP Code:
//+------------------------------------------------------------------+
//|                                                        Eagle.mq4 |
//|                                                                  |
//|                                                                  |
//+------------------------------------------------------------------+
#property copyright ""
#property link      ""


//Input Parameters----------------------------------------------------
 
extern double StopLoss 10;
extern double TakeProfit 20;
extern double TrailingStop 10;
extern double Lots 1.0;
extern int ShiftUP 10//How much pips to buy above price
extern int ShiftDOWN 10//How much pips to sell below price
extern int StartHour 12;
extern int StartMinute 30;
extern int StartSecond 00;
int Magic=10000000000000
 
//Start Coding--------------------------------------------------------- 
 
int start()
{
if (
OrdersTotal()==0
  {
    if (
Hour()==StartHour)
      {
        if (
Minute()>=StartMinute)
          {
            if (
Seconds()>=StartSecond)
              {
                
OrderSend(Symbol(),OP_BUYSTOP,Lots,Ask+ShiftUP*Point,3,Ask-StopLoss*Point+ShiftUP*Point,Ask+TakeProfit*Point+ShiftUP*Point,"learn the syntax",Magic,0,Green); 
                
OrderSend(Symbol(),OP_SELLSTOP,Lots,Bid-ShiftDOWN*Point,3,Bid+StopLoss*Point-ShiftDOWN*Point,Bid-TakeProfit*Point-ShiftDOWN*Point,"learn the syntax",Magic,0,Green);
              }
          }           
      }
  }

Return(
0);

I woke up today, and I ran the Eagle in real-time, and it only set a buystop. Then, I did it a second time, and it did everything right. Then, I did it the third time, and it only made a sellstop. I think something is wrong with my code, can You please check it Michel, or anyone.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #157 (permalink)  
Old 08-01-2007, 10:33 PM
Member
 
Join Date: Jul 2007
Posts: 41
MQL4 is on a distinguished road
New, Fresh Questios

1)What is the code to have a comment at the bottom left corner a certain color, and font, and font size? For example, I want the comment to say: Good Day being blue colored, Papyrus font, 10 size font.

2)If I have, for example 5 orders open, I what is the code to close, for example, the 1st order, not all of them?

3)Are there codes for milliseconds, or even smaller?

4)If I bought, for example, I want a trailingstop 2 pips under each low of a new bar.

Thank You,


MQL4.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #158 (permalink)  
Old 08-01-2007, 10:48 PM
Member
 
Join Date: Jun 2007
Posts: 48
mas0n is on a distinguished road
Make sure you use prefix such as "pbstat", so you can use another function to delete them in deinit()

Code:
void objectCreate(string name,int x,int y,string text="-",int size=42,
                  string font="Arial",color colour=CLR_NONE)
  {
   ObjectCreate(name,OBJ_LABEL,0,0,0);
   ObjectSet(name,OBJPROP_CORNER,PBCorner);
   ObjectSet(name,OBJPROP_COLOR,colour);
   ObjectSet(name,OBJPROP_XDISTANCE,x);
   ObjectSet(name,OBJPROP_YDISTANCE,y);
   ObjectSetText(name,text,size,font,colour);
  }

void DeleteAllObjects()
{
   int objs = ObjectsTotal();
   string name;
   for(int cnt=ObjectsTotal()-1;cnt>=0;cnt--)
   {
      name=ObjectName(cnt);
      if (StringFind(name,"pbstat",0)>-1) ObjectDelete(name);
      ObjectsRedraw();
   }
}
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #159 (permalink)  
Old 08-02-2007, 01:36 AM
iscuba11's Avatar
Senior Member
 
Join Date: May 2006
Location: Houston
Posts: 399
iscuba11 is on a distinguished road
Smile Code Confusion!

envtop_cur0=iEnvelopes(NULL,0,30,0,5,0,-0.04,2,0);//TopBand


envbottom_cur0=iEnvelopes(NULL,0,30,0,5,0,0.04,1,0 );//BottomBand


Something is not right with above - Can someone spot and fix this code??

Dave
<><<<

Much thanks in advance!!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #160 (permalink)  
Old 08-02-2007, 02:39 AM
Member
 
Join Date: Jul 2007
Posts: 41
MQL4 is on a distinguished road
Thank You Mas0n,
I do not get this half page code. Would You please write me how to create just 1 simple label, and how to change the font, font size, and color of it.

Thank You,







MQL4.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks

Tags
automated close order, close, eas, forex, learn mql4, learn mql4 video, mql4 learning, OrderCloseBy, profit, reach, secure profit function, T101_v1.11_orest_IBFXm.mq4, learning mql4

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Learning Cycles For New Traders Dan7974 General Discussion 350 01-18-2008 07:04 PM
Learning to code for autotrading GoatT Metatrader Programming 8 01-10-2007 09:55 PM
Self learning expert mrtools Expert Advisors - Metatrader 4 32 10-22-2006 06:29 PM


All times are GMT. The time now is 09:05 AM.



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