Would you please code a simple EA for me? (VSA)

I am trying to find an EA. It will just alert me when volume of the last candle closed is lower than the previous two in any 5m, 15m, 30m or 1h TF. That’s it.

I am not so good in coding in mql language, but i have studied VSA (starting from the father Mr. Richard Whyckoff) very good, and after that i must say that it is not so helpfull in trading, specially in forex, where u do not have real volumes datas but only tick volumes data! Some “Wyckoff” patetrn like Springs and Upthrusts are usefull, but on daily charts and are very rare! Anyway some months ago i have found something like what u are asking but i do not remember in what forum!

Thank u very much Dude. I think i will try to code it myself. I have also spent so much time to learn VSA and i found it very useful. My main problem is to recognise set ups on time because i have a full time job. When i complete coding, i will share my results here. Thanks a lot

EA code is for MT4 I have no idea what VSA is.

//±-----------------------------------------------------------------+
#property copyright “Copyright 2014, SDC”
#property link “Ian Venner - SDC - Trader’s profile - MQL5.community
#property version “1.01”
#property description “Volume Down Alert”
#property strict
//±-----------------------------------------------------------------+
void OnTick()
{
//—
const int ichart[4]={5,15,30,60};
static datetime time[4]={0};
string bartime=NULL;
//—
for(int i=0; i<4; i++)
{if(iTime(NULL,ichart[i],0)>time[i])
{time[i]=iTime(NULL,ichart[i],0);
if(iVolume(NULL,ichart[i],1)<iVolume(NULL,ichart[i],2))
{if(iVolume(NULL,ichart[i],1)<iVolume(NULL,ichart[i],3))
{bartime=TimeToStr(iTime(NULL,ichart[i],0),TIME_MINUTES);
Alert("Volume Down: “,Symbol(),” ",ichart[i],"m ",bartime);
}}}}}
//±-----------------------------------------------------------------+

Hi SDC!

Thank you very much for your help. I used it. It works well but EA gives alerts before completion of a TF also. I think that it checks volume every 5M and alerts if “lower than previous two” condition fulfilled on on any TF (5M, 15M, 30M, 1H) at that time. For example, it alerts for 15M, 30M, 1H TF on 20:50 or 20:55 but it should alert on 20:45 or 21:00 for 15M TF, 21:00 or 21:30 for 30M TF and 21:00 or 22:00 for 1H TF.

One more point;

I tried to set up Sendnotification code for my mobile phone. I wrote directly SendNotification(“Volume Down”); and got notifications but without any details. Then, I made copy paste your alert code line by changing it as SendNotification but not it says “wrong parameters count”. How can i fix these issues?

Thank you very much

I coded it to test each timeframe separately on every tick… When you first attach it to a chart it will test the conditions on each timeframe right away and Alert if the conditions are true. After that when it detects a new bar formed on one of the timeframes it checks that timeframe for the volumes and if they are down it alerts. it does that for each timeframe seperately.
Post your code with the changes and i will tell you what is wrong with the phone alert

Edit: I tested the EA and could not replicate the issue you are talking about are you sure you copied the code correctly ? As you can see below when I run it, the Alerts are correct for the timeframes.

Volume Down Alert EURUSD,H1: Alert: Volume Down: EURUSD 5m 04:25
Volume Down Alert EURUSD,H1: Alert: Volume Down: EURUSD 5m 04:20
Volume Down Alert EURUSD,H1: Alert: Volume Down: EURUSD 5m 04:15
Volume Down Alert EURUSD,H1: Alert: Volume Down: EURUSD 5m 03:50
Volume Down Alert EURUSD,H1: Alert: Volume Down: EURUSD 15m 03:45
Volume Down Alert EURUSD,H1: Alert: Volume Down: EURUSD 5m 03:45
Volume Down Alert EURUSD,H1: Alert: Volume Down: EURUSD 5m 03:35
Volume Down Alert EURUSD,H1: Alert: Volume Down: EURUSD 5m 03:15
Volume Down Alert EURUSD,H1: Alert: Volume Down: EURUSD 5m 02:55
Volume Down Alert EURUSD,H1: Alert: Volume Down: EURUSD 30m 02:30
Volume Down Alert EURUSD,H1: Alert: Volume Down: EURUSD 15m 02:30
Volume Down Alert EURUSD,H1: Alert: Volume Down: EURUSD 5m 02:30
Volume Down Alert EURUSD,H1: Alert: Volume Down: EURUSD 5m 02:15
Volume Down Alert EURUSD,H1: Alert: Volume Down: EURUSD 5m 02:05

So sorry Man! It’s my fault. You are right. I works fine.

I’ve added one more line to get mobile notifications. Please check it below;

//±-----------------------------------------------------------------+
#property copyright “Copyright 2014, SDC”
#property link “Ian Venner - SDC - Trader’s profile - MQL5.community
#property version “1.01”
#property description “Volume Down Alert”
#property strict
//±-----------------------------------------------------------------+
void OnTick()
{
//—
const int ichart[4]={5,15,30,60};
static datetime time[4]={0};
string bartime=NULL;
//—
for(int i=0; i<4; i++)
{if(iTime(NULL,ichart[i],0)>time[i])
{time[i]=iTime(NULL,ichart[i],0);
if(iVolume(NULL,ichart[i],1)<iVolume(NULL,ichart[i],2))
{if(iVolume(NULL,ichart[i],1)<iVolume(NULL,ichart[i],3))
{bartime=TimeToStr(iTime(NULL,ichart[i],0),TIME_MINUTES);
Alert("Volume Down: “,Symbol(),” ",ichart[i],"m ",bartime);
SendNotification("Volume Down: " + Symbol()+ ichart[i] + “M” + bartime);
}}}}}
//±-----------------------------------------------------------------+

It is now Ok. It gives “implicit conversion from number to string” warning but works. I get mobile notifications as “Volume Down: EURUSD60M18:00” for example.

I will try to improve this code if i can. I have no any idea how to code but i will try to do my best :slight_smile:

Thank you very much for your help buddy

Little bit more efficient code… doesn’t access timeframes array all the time anymore, and only builds the alert string once.
For some reason the text editor here keeps putting a space before the S in TIME_MINUTE S. I tried changing the font but it doesnt go away.
Edit OK I put code tags around it that seems to fix it. Makes it a pain to copy paste though, it all goes into one line.


//+-------------------------------------------------------------------------------+
#property copyright "Copyright 2014, SDC"
#property link      "https://login.mql5.com/en/users/sdc"
#property version   "1.02"
#property description "Volume Down Alert"
#property strict
//+-------------------------------------------------------------------------------+
void OnTick()
 {
//---
  const int timeframe[4]={5,15,30,60};
  static datetime time[4]={0};
  string bartime=NULL;
  string inform=NULL;
  int chart=0;
//---   
  for(int i=0; i<4; i++)
  {chart=timeframe[i];
   if(iTime(NULL,chart,0)>time[i])
   {time[i]=iTime(NULL,chart,0);
    if(iVolume(NULL,chart,1)<iVolume(NULL,chart,2))
    {if(iVolume(NULL,chart,1)<iVolume(NULL,chart,3))
      bartime=TimeToStr(time[i],TIME_MINUTES);
      inform=StringConcatenate("Volume Down:  ",Symbol(),"  ",chart,"m  ",bartime);
      Alert(inform);
      SendNotification(inform);
 }}}}}
//+-------------------------------------------------------------------------------+

Thank you very much SDC!

I tried it and like :slight_smile:

I am now trying to add some more on it. I will share here soon. I hope you help me if i fail :slight_smile:

Thank you very much for your help buddy

Regards,
RTK