Coding help - page 538

 

I have posted on FF and now on MQL forum, so im trying my luck here.

Before i start, i want to mention that i am by no means a coder, barely a script kiddie. I have managed to store realtime price in excel with timestamp. Is there a way to only store when price is moving? Because excel keeps storing every seconds, meaning there will be lots of empty spaces with timestamp.

While im at it, is there also a way to code so that when every minute passes, it jumps to the next column and stores from there? Im using xlsapp to code. Here is the code:

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

//| Test1.mq4 |

//| Copyright 2015, MetaQuotes Software Corp. |

//| / |

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

#property copyright "Copyright 2015, MetaQuotes Software Corp."

#property link "https://www.mql5.com"

#property version "1.00"

#property strict

#include

extern string StartBid= "C3";

extern string StartAsk= "D3";

extern string StartSpread="F3";

extern string StartTime="A3";

bool xlsgateok=false;

string StrBid;

string StrAsk;

string StrSpread;

string StrTime;

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

//| Expert initialization function |

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

int OnInit()

{

StrBid=StartBid;

StrAsk=StartAsk;

StrSpread=StartSpread;

StrTime=StartTime;

if (ExcelInit("mt4") && ExcelStart(""))

{

Print("XLSgate init done");

xlsgateok=true;

Print("Office version = "+ExcelVersion());

ExcelSheetAdd("MT4");

}

//---

return(INIT_SUCCEEDED);

}

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

//| Expert deinitialization function |

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

void OnDeinit(const int reason)

{

//---

}

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

//| Expert tick function |

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

double lastBid=0;

double lastAsk=0;

int lastSpread=0;

datetime time=0;

void OnTick()

{

//---

if(xlsgateok && lastBid!=Bid)

ExcelSetValue(StrBid,Bid);

lastBid=Bid;

StrBid=ExcelRowAdd(StrBid,1);

if(xlsgateok && lastAsk!=Ask)

ExcelSetValue(StrAsk,Ask);

lastAsk=Ask;

StrAsk=ExcelRowAdd(StrAsk,1);

ExcelSetValue(StrSpread,(Ask-Bid)/Point);

StrSpread=ExcelRowAdd(StrSpread,1);

string s= TimeToStr(TimeCurrent());

ExcelSetString(StrTime,s);

StrTime=ExcelRowAdd(StrTime,1);

}

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

 
mladen:
henrykfx They are never going to be the same simply because the indicator you posted is repainting. They can not be the same

Miaden, please either it repaints or not, just do me a favor and include the pop up notification and sound alert, and allow me to grief or rejoice over it; after all one man's poison is another man's meat, while one man's meat is another man's poison . If you can effortlessly help others , i do not see reasons why my own case should be a taboo. please do it for me even if it is your christmas gift to me, i will very much appreciate it. The more you delay, the more you deny me of trading.

 
henrykfx:
Miaden, please either it repaints or not, just do me a favor and include the pop up notification and sound alert, and allow me to grief or rejoice over it; after all one man's poison is another man's meat, while one man's meat is another man's poison . If you can effortlessly help others , i do not see reasons why my own case should be a taboo. please do it for me even if it is your christmas gift to me, i will very much appreciate it. The more you delay, the more you deny me of trading.

I do not code alerts for REPAINTING indicators. Check, for example, this thread : https://www.mql5.com/en/forum/180648 and see how many times I refused to do that and how many times I told that using repainting indicators in signaling/alerting mode is very dangerous. So, you are not an exception but your request is a rule of thumb for me : I do not want to take part in a thing that I consider dangerous for traders

all the best

 

The very last request!

To all coders out there, but with special thanks to mladen. Not only for his coding, but also for his patients in the many, & sometimes stupid, requests I have made over the years. Thanks fellow....it really is much appreciated.

May I ask one final thing of you?

Could you add a wave alert function to the LOWER alert line on the attached 'Advanced ADX' indicator?

User choice of Wav. sound?

To function ONLY on a rising bar.

If all goes well I will be posting my system, with result in the near future.

Files:
 
Jeeves:
To all coders out there, but with special thanks to mladen. Not only for his coding, but also for his patients in the many, & sometimes stupid, requests I have made over the years. Thanks fellow....it really is much appreciated.

May I ask one final thing of you?

Could you add a wave alert function to the LOWER alert line on the attached 'Advanced ADX' indicator?

User choice of Wav. sound?

To function ONLY on a rising bar.

If all goes well I will be posting my system, with result in the near future.

Jeeves

Will be made

 

You're the man my friend.....anything I can ever do for you, PM me.

 
mrtools:
Hello Henrykfx, like I said earlier the CROSS indicator is a repainting EMA cross indicator, if you go to the link I provided and download that indicator and set the MaType to EMA and the fast Ma period to 5 and the slow Ma period to 20 then you will be getting real EMA cross values with no repainting of the arrows on a closed bar, and with alerts.

Ok mrtools, thanks for your interest in my plight. Now i got what i wanted , but the problem with is that it sounds alert and pop up for next bar. can you help me to fix the bug. so that the alerts and pop up notification WILL BE WHEN AND WHERE THERE IS A SIGNAL OF BUY OR SELL.Thanks for your time .

 
mladen:
I do not code alerts for REPAINTING indicators. Check, for example, this thread : https://www.mql5.com/en/forum/180648 and see how many times I refused to do that and how many times I told that using repainting indicators in signaling/alerting mode is very dangerous. So, you are not an exception but your request is a rule of thumb for me : I do not want to take part in a thing that I consider dangerous for traders all the best

Thanks for your frank reply. In my unrelenting search, i got one that is useful but it sound alerts and notify at the opening of a new bar. can you help me to fix the bug, so as to alert and notify when there is BUY OR SELL signal only. Thanks for your time .

 
henrykfx:
Thanks for your frank reply. In my unrelenting search, i got one that is useful but it sound alerts and notify at the opening of a new bar. can you help me to fix the bug, so as to alert and notify when there is BUY OR SELL signal only. Thanks for your time .

henrykfx

That indicator too uses future values (repaints) - it uses exactly the same logic as the previous one that we were talking about

all the best

 
mladen:
henrykfx

That indicator too uses future values (repaints) - it uses exactly the same logic as the previous one that we were talking about

all the best

Mladen, You the other day said that 99% indicator don't repaint. You everywhere write "repaint, repaint, repaint"

Reason: