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
  #1131 (permalink)  
Old 06-07-2008, 05:42 PM
IN10TION's Avatar
Senior Member
 
Join Date: Mar 2007
Posts: 569
Blog Entries: 1
IN10TION is on a distinguished road
it is correct... but...
if you have 10.000 bars per chart and/or multiple charts... every time, if there is a tick from new quotes, it will recalculate the total indicator from the beginning, that will make the performance much slower and unneeded...

There is also a fault in your stochastic signal OzFX_Regular part between UP and DOWN differences ( if function )

Quote:
Originally Posted by sonicdeejay View Post
the for loop is correct???

PHP Code:
int start()
{
   for (
Bars 205>= 0--)
   { 

Last edited by IN10TION; 06-07-2008 at 07:06 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1132 (permalink)  
Old 06-07-2008, 06:50 PM
IN10TION's Avatar
Senior Member
 
Join Date: Mar 2007
Posts: 569
Blog Entries: 1
IN10TION is on a distinguished road
I've searched long enough now ... the only solution I see and also the best is using ObjectCreate, I came to that conclusion also few months ago, if you're happy with the bitmap code 110 or other sign, use that... I use in my software much times ObjectCreate, it's doing a great job and even better, don't worry about slowing down your application, even 200.000 objects will not slowing down. Also, your index buffers will be free to do other data calculations if needed (you have only 8). With objectCreate you have more free choices to color sign special points on your chart, unlimited ...

share your thoughts, I'm here ...

little extra: SetIndexArrow(0,59); (change 110 in 59, it looks like a dash, with the "width" you can make it a little bigger)


Quote:
Originally Posted by kiromano View Post
Thanks for the reply,

This is the section of code. It's just a moving average envelope that I would like to have mark the high and low points on each bar. Since I am using about six or eight points on each bar, the dash would crowd the screen less than the current smallest arrow I could find (the "110" square arrow shape).

//---- indicators
IndicatorBuffers(2);

SetIndexBuffer(0,ma1);
SetIndexBuffer(1,ma2);

SetIndexStyle(0,DRAW_ARROW,0,0);
SetIndexStyle(1,DRAW_ARROW,0,0);
SetIndexArrow(0,110);
SetIndexArrow(1,110);
SetIndexShift(0,shift);
SetIndexShift(1,shift);
SetIndexLabel(0,"MA Down");
SetIndexLabel(1,"MA Up");
//----
return(0);


I have attached a pic with two MA's indicated. You can see what I have once I activate all 4 of them.
Attached Images
File Type: jpg screen___3.jpg (51.5 KB, 147 views)

Last edited by IN10TION; 06-07-2008 at 06:59 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1133 (permalink)  
Old 06-07-2008, 07:24 PM
Beno's Avatar
Senior Member
 
Join Date: Aug 2006
Location: London
Posts: 361
Beno is on a distinguished road
Multi indicator question

Hello

I have a system that I have trading live but manually it has 5 indicators.

Slope Direction for general trend direction. And 4 others.

With the 4 others I only enter a position only if any 3 out of the 4 have fire a signal and are in the same direction as the Slope Direction indicator When coding can this sort or discretion be coded into an EA.

I would like to think it can be after seeing some of the fantastic EA's the are knocking around this forum

Last edited by Beno; 06-07-2008 at 07:32 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1134 (permalink)  
Old 06-07-2008, 08:34 PM
IN10TION's Avatar
Senior Member
 
Join Date: Mar 2007
Posts: 569
Blog Entries: 1
IN10TION is on a distinguished road
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.

Quote:
Originally Posted by Beno View Post
Hello

I have a system that I have trading live but manually it has 5 indicators.

Slope Direction for general trend direction. And 4 others.

With the 4 others I only enter a position only if any 3 out of the 4 have fire a signal and are in the same direction as the Slope Direction indicator When coding can this sort or discretion be coded into an EA.

I would like to think it can be after seeing some of the fantastic EA's the are knocking around this forum
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1135 (permalink)  
Old 06-07-2008, 09:03 PM
kiromano's Avatar
Junior Member
 
Join Date: Feb 2008
Posts: 6
kiromano is on a distinguished road
in10tion,

Couldn't see the "tree" for the "forest" (I said it backwards on purpose), the 59 arrow code does just fine. I just like simpler whenever I can get it. The objectcreate function involves a little more if I'm going to create and leave it on the chart. Plus I use the different levels through iCustom.

Much obliged.

May the pip gods look upon you favorably.

Quote:
Originally Posted by IN10TION View Post
I've searched long enough now ... the only solution I see and also the best is using ObjectCreate, I came to that conclusion also few months ago, if you're happy with the bitmap code 110 or other sign, use that... I use in my software much times ObjectCreate, it's doing a great job and even better, don't worry about slowing down your application, even 200.000 objects will not slowing down. Also, your index buffers will be free to do other data calculations if needed (you have only 8). With objectCreate you have more free choices to color sign special points on your chart, unlimited ...

share your thoughts, I'm here ...

little extra: SetIndexArrow(0,59); (change 110 in 59, it looks like a dash, with the "width" you can make it a little bigger)
__________________
“A loss never bothers me after I take it. I forget it overnight. But being wrong - not taking the loss - that is what does damage to the pocketbook and to the soul.”
Jesse Livermore.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1136 (permalink)  
Old 06-08-2008, 09:22 AM
cutzpr's Avatar
Member
 
Join Date: Jan 2008
Posts: 50
cutzpr is on a distinguished road
Quote:
Originally Posted by IN10TION View Post
try this one...
Thank you very much for your help. Sincerely appreciated.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1137 (permalink)  
Old 06-08-2008, 01:07 PM
cutzpr's Avatar
Member
 
Join Date: Jan 2008
Posts: 50
cutzpr is on a distinguished road
Lost again

Could someone please take a look at this code for my EA. It is a simple SAR EA. It is in its first stages and I will be adding other indicators to filter out signals. But for the mean time. My EA opens positions, but doesnt close them.

I would appreciate any feedback. Thank you.
PHP Code:
//+------------------------------------------------------------------+
//|                                                RSI_Filter_EA.mq4 |
//|                      Copyright © 2008, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2008, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"

//---- input parameters
extern double Lots=1.0;

//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
{
int totalticket;
double Sg;
double sfRSIlfRSI;
bool CanopenCanclose;

  if(
Bars<100//Minium amount of bars the indicators will need to work
     
{
      Print(
"bars less than 100, Expert will not execute");
      return(
0);  
     }
//*******Start of function iCustom************
Sg=iCustom(NULL,0,"RSIMixFilter_v1",0,0,0);

total=OrdersTotal();   
  if(
total<1
     {
     
Canopen=true;
     
Canclose=false;
     }
     else if(
total>0)
     {
     
Canopen=false;
      
Canclose=true;
     }
//Booleans used to control when order will be open and closed. Only
//one order will be open at any given time. The EA will always be in the market.

   
if(Canopen==true)
        {
      if (
Sg>0
      
//If both RSI filters are above zero, then they are long.We place buy order.
      
                  
{
            
ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,3,0,0,"RSIFilter",12345,0,Green);
            
                   if(
ticket>0)
                   {
                      if(
OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES))
                     Print(
"BUY order opened : ",OrderOpenPrice());
                   }
                 else Print (
"Error opening BUY order : ",GetLastError());
            return (
0);
            }
            
      else if (
Sg<0
      
// If both RSI filters are below zero, then they are short. We place sell order.
            
{
            
ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,3,0,0,"RSIFilter",12345,0,Red);
 
                if (
ticket>0)
                   {
                      if(
OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES))
                         Print (
"Sell order opened : ",OrderOpenPrice());
                   }
                else Print(
"Error opening SELL Order : ",GetLastError());
            return (
0);
           }
    }
    
   if(
Canclose==true)
        {
        
OrderSelect(ticketSELECT_BY_POSMODE_TRADES);

            
            if(
OrderType()<=OP_SELL && OrderSymbol()==Symbol())
                    if(
OrderType()==OP_BUY)                             //Long position is opened
                        
{                                               //should the long position be closed?
                            
if(Sg<0//If any of these are true, the open long order will be closed
                                
{
                                
OrderClose(OrderTicket(),OrderLots(),Bid,3,Violet); // Long position closed.
                                
return(0);
                                }
                        }
                    
                    else if(
OrderType()==OP_SELL)                 //Short position is opened.
                        
{                                                    //Should the short position be closed?
                            
if(Sg>0)
                                {
                                
OrderClose(OrderTicket(),OrderLots(),Ask,3,Violet); // Short position closed.
                                
return(0);
                                }
                        }
            return (
0);
        }    

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1138 (permalink)  
Old 06-08-2008, 06:28 PM
IN10TION's Avatar
Senior Member
 
Join Date: Mar 2007
Posts: 569
Blog Entries: 1
IN10TION is on a distinguished road
Post

change this...

you have this:
Sg=iCustom(NULL,0,"RSIMixFilter_v1",0,0,0);

it has to be this:
Sg=iCustom(NULL,0,"RSIMixFilter_v1",3,10,0,0);
or this:
Sg=iCustom(NULL,0,"RSIMixFilter_v1",3,10,0,1);

Do you see the difference between the 2 choices, at the end? 0 or 1, I prefer 1, because then it doesn't give much false signals when the bar is forming at current time.

info:
Do a test with H1 EURUSD from 2007 till now, nice profit
but it will fail for not strong trending currencies... like JPY... meaning for long term one direction, JPY is too violent in trending for only this RSIMixFilter.
Perhaps some beter coding can do the trick.
keep me informed

good luck!!



Quote:
Originally Posted by cutzpr View Post
Could someone please take a look at this code for my EA. It is a simple SAR EA. It is in its first stages and I will be adding other indicators to filter out signals. But for the mean time. My EA opens positions, but doesnt close them.

I would appreciate any feedback. Thank you.
PHP Code:
//+------------------------------------------------------------------+
//|                                                RSI_Filter_EA.mq4 |
//|                      Copyright © 2008, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2008, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"

//---- input parameters
extern double Lots=1.0;

//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
{
int totalticket;
double Sg;
double sfRSIlfRSI;
bool CanopenCanclose;

  if(
Bars<100//Minium amount of bars the indicators will need to work
     
{
      Print(
"bars less than 100, Expert will not execute");
      return(
0);  
     }
//*******Start of function iCustom************
Sg=iCustom(NULL,0,"RSIMixFilter_v1",0,0,0);

total=OrdersTotal();   
  if(
total<1
     {
     
Canopen=true;
     
Canclose=false;
     }
     else if(
total>0)
     {
     
Canopen=false;
      
Canclose=true;
     }
//Booleans used to control when order will be open and closed. Only
//one order will be open at any given time. The EA will always be in the market.

   
if(Canopen==true)
        {
      if (
Sg>0
      
//If both RSI filters are above zero, then they are long.We place buy order.
      
                  
{
            
ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,3,0,0,"RSIFilter",12345,0,Green);
            
                   if(
ticket>0)
                   {
                      if(
OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES))
                     Print(
"BUY order opened : ",OrderOpenPrice());
                   }
                 else Print (
"Error opening BUY order : ",GetLastError());
            return (
0);
            }
            
      else if (
Sg<0
      
// If both RSI filters are below zero, then they are short. We place sell order.
            
{
            
ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,3,0,0,"RSIFilter",12345,0,Red);
 
                if (
ticket>0)
                   {
                      if(
OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES))
                         Print (
"Sell order opened : ",OrderOpenPrice());
                   }
                else Print(
"Error opening SELL Order : ",GetLastError());
            return (
0);
           }
    }
    
   if(
Canclose==true)
        {
        
OrderSelect(ticketSELECT_BY_POSMODE_TRADES);

            
            if(
OrderType()<=OP_SELL && OrderSymbol()==Symbol())
                    if(
OrderType()==OP_BUY)                             //Long position is opened
                        
{                                               //should the long position be closed?
                            
if(Sg<0//If any of these are true, the open long order will be closed
                                
{
                                
OrderClose(OrderTicket(),OrderLots(),Bid,3,Violet); // Long position closed.
                                
return(0);
                                }
                        }
                    
                    else if(
OrderType()==OP_SELL)                 //Short position is opened.
                        
{                                                    //Should the short position be closed?
                            
if(Sg>0)
                                {
                                
OrderClose(OrderTicket(),OrderLots(),Ask,3,Violet); // Short position closed.
                                
return(0);
                                }
                        }
            return (
0);
        }    

Attached Images
File Type: jpg TesterGraph.jpg (60.9 KB, 113 views)

Last edited by IN10TION; 06-08-2008 at 06:41 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1139 (permalink)  
Old 06-09-2008, 03:23 AM
cutzpr's Avatar
Member
 
Join Date: Jan 2008
Posts: 50
cutzpr is on a distinguished road
IN10TION

Thank you so much for you help. I dont know what I would do with out the generosity of people like yourself. Thank you for sharing you knowledge. I have learned so much and have gotten to much from this forum already. Thank you. I will definately keep you updated. Again, Thank you.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #1140 (permalink)  
Old 06-09-2008, 03:08 PM
Junior Member
 
Join Date: Oct 2006
Posts: 12
forexcel is on a distinguished road
Help Needed Please!!!

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
Reply

Bookmarks