Please fix this indicator or EA - page 164

 
kerdoskopos2000:
Re: Please fix this indicator or EA That's the problem mladen... I can't find a pivot indicator with a shift feature that can autorefresh it's lines!!! I'll check the pivot thread again and maybe I am missing something. Thanks anyway.

kerdoskopos2000

check the elite sections too. I am almost 100% sure that you shall find what you need

 

Can someone check this indicator : mtrendline__alert.mq4

Files:
 

Hello Mladen and MrTools,

Could you please add an alert to Tampa's indi ?

https://www.forex-tsd.com/forum/debates-discussions/116-something-interesting-please-post-here/page689#comment_1767199

BTW,love your work

Cheers !

 

Mladen and MrTools i really really need the help of you guys. i need an ea that will open trade on a price i will set. say for example in eur usd i set the price 1.2000 then if the candle closes above that price the ea should open a buy deal and for sell another price i will select for example 1.1990 so when the candle closes below that then ea will open a sell order according to the lot size i will put init. and in a sell situation if its in a trade and the rate goes up again and closes above the mentioned 1.2000 then it will close the existing sell deal and open a buy deal, guys please if u do this for me it will be amazing, i work 2 jobs i can just cannot keep my focus on one hour candle and its costing me money and frustration me. i dont even know if this is the right place to post this request, so if i made a mistake i apologize.

 

Hi, my EA seems to be giving me some problems here that I can't seem to figure out. My trading criteria are as follows.

- Trigger trade based on MA line crosses up or down.

- Only 1 trade will be trigger per MA line cross

- No maximum number of open trades

However, my EA seems to trigger a trade every time the MA line is up or down instead of only triggering when it crosses, it will open a trade as long as the MA line is crossed up or down.

Below is my code.

Thanks in advance for the assistance.

Regards

-------------------------------------------------------------------------------------------------------------------

//---- input parameters

extern double TakeProfit = 650.0;

extern double StopLoss = 450.0;

extern double Lots=0.1;

//+------------------------------------------------------------------+

//| expert initialization function |

//+------------------------------------------------------------------+

int init()

{

//----

//----

return(0);

}

//+------------------------------------------------------------------+

//| expert deinitialization function |

//+------------------------------------------------------------------+

int deinit()

{

//----

//----

return(0);

}

//+------------------------------------------------------------------+

//| expert start function |

//+------------------------------------------------------------------+

datetime newbar;

int start()

{

if(newbar==Time[0])return(0);

else newbar=Time[0];

int ticket, total;

if(Bars<100)

{

Print("bars less than 100");

return(0);

}

if(TakeProfitM30<10 || TakeProfitH4<10)

{

Print("TakeProfit less than 10");

return(0); // check TakeProfit

}

//+------------------------------------------------------------------+

double MA_LWMA3 = iMA(NULL,0,3,0,MODE_LWMA,PRICE_CLOSE,0);

double MA_LWMA5 = iMA(NULL,0,5,0,MODE_LWMA,PRICE_CLOSE,0);

//+------------------------------------------------------------------+

total = OrdersTotal();

if(total < 999)

{

if(MA_LWMA3 > MA_LWMA5) // Long criteria

{

ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,1,Ask-StopLoss*Point,Ask+TakeProfit*Point,

"My EA",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);

}

if(MA_LWMA3 < MA_LWMA5) // Short criteria

{

ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,1,Bid+StopLoss*Point,Bid-TakeProfit*Point,

"My EA",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);

}

return(0);

}

return(0);

}

//+------------------------------------------------------------------+

 
tkuan77:
Hi, my EA seems to be giving me some problems here that I can't seem to figure out. My trading criteria are as follows.

- Trigger trade based on MA line crosses up or down.

- Only 1 trade will be trigger per MA line cross

- No maximum number of open trades

However, my EA seems to trigger a trade every time the MA line is up or down instead of only triggering when it crosses, it will open a trade as long as the MA line is crossed up or down.

Below is my code.

Thanks in advance for the assistance.

Regards

-------------------------------------------------------------------------------------------------------------------

//---- input parameters

extern double TakeProfit = 650.0;

extern double StopLoss = 450.0;

extern double Lots=0.1;

//+------------------------------------------------------------------+

//| expert initialization function |

//+------------------------------------------------------------------+

int init()

{

//----

//----

return(0);

}

//+------------------------------------------------------------------+

//| expert deinitialization function |

//+------------------------------------------------------------------+

int deinit()

{

//----

//----

return(0);

}

//+------------------------------------------------------------------+

//| expert start function |

//+------------------------------------------------------------------+

datetime newbar;

int start()

{

if(newbar==Time[0])return(0);

else newbar=Time[0];

int ticket, total;

if(Bars<100)

{

Print("bars less than 100");

return(0);

}

if(TakeProfitM30<10 || TakeProfitH4<10)

{

Print("TakeProfit less than 10");

return(0); // check TakeProfit

}

//+------------------------------------------------------------------+

double MA_LWMA3 = iMA(NULL,0,3,0,MODE_LWMA,PRICE_CLOSE,0);

double MA_LWMA5 = iMA(NULL,0,5,0,MODE_LWMA,PRICE_CLOSE,0);

//+------------------------------------------------------------------+

total = OrdersTotal();

if(total < 999)

{

if(MA_LWMA3 > MA_LWMA5) // Long criteria

{

ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,1,Ask-StopLoss*Point,Ask+TakeProfit*Point,

"My EA",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);

}

if(MA_LWMA3 < MA_LWMA5) // Short criteria

{

ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,1,Bid+S topLoss*Point,Bid-TakeProfit*Point,

"My EA",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);

}

return(0);

}

return(0);

}

//+------------------------------------------------------------------+

tkuan77

Change the conditions checking to this :

double diffc = iMA(NULL,0,3,0,MODE_LWMA,PRICE_CLOSE,0)-iMA(NULL,0,5,0,MODE_LWMA,PRICE_CLOSE,0);

double diffp = iMA(NULL,0,3,0,MODE_LWMA,PRICE_CLOSE,1)-iMA(NULL,0,5,0,MODE_LWMA,PRICE_CLOSE,1);

if (diffc*diffp<0)

(

if diffc>0 // cross up

if diffc<0 // cross down

)

and it will check for crosses

 

Hello, could I kindly ask you to fix this script? I've had Open, High, Low, Close and many other indicators on the old version of MT4. However, I updated MT4 and it is no longer working.

csv_export_script.mq4

Many thanks,

Karl

Files:
 
akrolytis:
Hello, could I kindly ask you to fix this script? I've had Open, High, Low, Close and many other indicators on the old version of MT4. However, I updated MT4 and it is no longer working.

csv_export_script.mq4

Many thanks,

Karl

Karl

All is working OK on my terminal (attaching a file that it produces without any change in code)

eurusd_data.zip

Files:
eurusd_data.zip  155 kb
 
mladen:

Karl

All is working OK on my terminal (attaching a file that it produces without any change in code)

eurusd_data.zip

Hello mladen,

It is very interesting, because I cannot get the same result. Even I cannot load the script. And one more issue with the data in the file that you attached. Please take a look at the pictures.

Could you help me with it? Thank you.

BR,

Karl

Files:
 

Hi mladen, I seem to be having problem getting my EA to work based on a breakout strategy. The EA is suppose to trigger either a long or a short trade based on the closed price of the 20th hour in the chart. In order to trigger a long, the breakout must be more than 30 pips in either 1 direction.

Attached below is my code.

Thanks again for your help.

//---- input parameters

extern double TakeProfit = 1000.0;

extern double Lots = 0.1;

extern double StopLoss = 980.0;

extern double Breakout = 300.0; // Breakout pip amount

extern int Entry_Hour_1st = 21;

//+------------------------------------------------------------------+

//| expert initialization function |

//+------------------------------------------------------------------+

int init()

{

//----

//----

return(0);

}

//+------------------------------------------------------------------+

//| expert deinitialization function |

//+------------------------------------------------------------------+

int deinit()

{

//----

//----

return(0);

}

//+------------------------------------------------------------------+

//| expert start function |

//+------------------------------------------------------------------+

datetime newbar; //Function set to limit to 1 trade per bar

int start()

{

//+------------------------------------------------------------------+

//| expert start function | set to limit to 1 trade per bar

//+------------------------------------------------------------------+

if(newbar==Time[0])return(0);

else newbar=Time[0];

//+------------------------------------------------------------------+

//+------------------------------------------------------------------+

//-- Trigger Trade

//+------------------------------------------------------------------+

int ticket, total;

double CD_Close, CD_Close_Up, CD_Close_Down, CurrentPrice;

CD_Close = iClose(NULL,0,1);

CD_Close_Up = CD_Close + Breakout*Point;

CD_Close_Down = CD_Close - Breakout*Point;

CurrentPrice = MarketInfo(Symbol(),MODE_BID);

total = OrdersTotal(); // check for total number of trades currently open

if(total < 1)

{

if (Hour()==Entry_Hour_1st && CurrentPrice > CD_Close_Up)

{

ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,1,Ask-StopLoss*Point,Ask+TakeProfit*Point,

"My EA",200,0,Green);

}

if (Hour()==Entry_Hour_1st && CurrentPrice < CD_Close_Down)

{

ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,1,Bid+StopLoss*Point,Bid-TakeProfit*Point,

"My EA",200,0,Red);

return(0);

}

}

return(0);

}

//+------------------------------------------------------------------+

Reason: