Please fix this indicator or EA - page 165

 
tkuan77:
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);

}

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

tkuan77

Can you explain in short, what exactly is the problem?

 
mladen:

tkuan77

Can you explain in short, what exactly is the problem?

Hi mladen, basically I am thinking there is something wrong with the codes here:

CD_Close_Up = CD_Close + Breakout*Point;

CD_Close_Down = CD_Close - Breakout*Point;

because when I run the program after i added this code in, the EA will not trigger any trades.

regards

 
mladen:

tkuan77

Can you explain in short, what exactly is the problem?

Sorry what I meant was when I added these particular codes in:

CD_Close_Up = CD_Close + Breakout*Point;

CD_Close_Down = CD_Close - Breakout*Point;

and change the long and sell criteria from the original:

if (Hour()==Entry_Hour_1st && CurrentPrice > CD_Close) to if (Hour()==Entry_Hour_1st && CurrentPrice > CD_Close_Up) for long trades

and

if (Hour()==Entry_Hour_1st && CurrentPrice < CD_Close) to if (Hour()==Entry_Hour_1st && CurrentPrice < CD_Close_Down) for short trades

the code stops triggering any trades and i can't seem to find the error.

What i am looking at is when the the price move above or below the close price of the 20th hour candlestick by 30pips, the program will trigger either a long or a short depending on if the breakout is above or below the close price of the 20th hour candlestick

regards

 
tkuan77:

Sorry what I meant was when I added these particular codes in:

CD_Close_Up = CD_Close + Breakout*Point;

CD_Close_Down = CD_Close - Breakout*Point;

and change the long and sell criteria from the original:

if (Hour()==Entry_Hour_1st && CurrentPrice > CD_Close) to if (Hour()==Entry_Hour_1st && CurrentPrice > CD_Close_Up) for long trades

and

if (Hour()==Entry_Hour_1st && CurrentPrice < CD_Close) to if (Hour()==Entry_Hour_1st && CurrentPrice < CD_Close_Down) for short trades

the code stops triggering any trades and i can't seem to find the error.

What i am looking at is when the the price move above or below the close price of the 20th hour candlestick by 30pips, the program will trigger either a long or a short depending on if the breakout is above or below the close price of the 20th hour candlestick

regards

Hi mladen, any idea or suggestions for this? I realized that when the hour is reached at 2100, the system will check on that time if the criteria is been met, however, if the criteria is been met at 2154 or 2100 and 34 sec, it will not be triggered.

Appreciate your help as always.

Regards

 

Ramdon wicks of this renkolivecharts_pimped_v4_13.mq4 EA exceed correct range - see image. Can mladen or colleagues kindle have a look. If this has been repair please post link.

Thanks in advance.

 
Phylo:
Ramdon wicks of this renkolivecharts_pimped_v4_13.mq4 EA exceed correct range - see image. Can mladen or colleagues kindle have a look. If this has been repair please post link. Thanks in advance.

Fix no longer required - this one appears to fix the wick problem.

 

Re Above - wrong EA unloaded. Correct EA RenkoLive_v600.4.1

 

I ported the above RenkoLiveChart_v600.4.1.mq4 code into the post MT4 build 600 new code format.

No errors were found but two types of numerous warning were cleared. 1) RenkoTimeFrame edited to IntegerToString(RenkoTimeFrame) and 2) LastFPos = FileTell(HstHandle) edited to LastFPos = (int)FileTell(HstHandle);

I have checked the above RenkoLiveChart_v600.4.1.mq4 against non MT4 reliable commercial package and the candles appear accurate and update in real time without error, but a fault exists.

If the Inputs variable ShowWicks is set to the value = false the wicks still remain.

Can mladen or colleagues kindle have a look. Thanks in advance.

 
Phylo:
I ported the above RenkoLiveChart_v600.4.1.mq4 code into the post MT4 build 600 new code format.

No errors were found but two types of numerous warning were cleared. 1) RenkoTimeFrame edited to IntegerToString(RenkoTimeFrame) and 2) LastFPos = FileTell(HstHandle) edited to LastFPos = (int)FileTell(HstHandle);

I have checked the above RenkoLiveChart_v600.4.1.mq4 against non MT4 reliable commercial package and the candles appear accurate and update in real time without error, but a fault exists.

If the Inputs variable ShowWicks is set to the value = false the wicks still remain.

Can mladen or colleagues kindle have a look. Thanks in advance.

Phylo

Did you try to use RenkoLiveChart indicators from the start of this thread?

 

mladen

Thank you for reply - I found RenkoMeanLive v1 on page 32 or thereabouts but it is broken.

Let me start from the beginning again because I have got myself confused with files (again). The file RenkoLiveChart_v600.4.1 referred to in the above post is incorrect and should have been RenkoLiveChart_v600.6.

I have managed to fix the failure to remove wicks when Inputs variable ShowWicks = false. The corrected code is commented and the EA is uploaded for any who may find it of use.

Reason: