My metatrader Experts and Indicators

headstrong007

----- Full-Time ----- Day-Trader
#41
//+------------------------------------------------------------------+
//| MA_In_Color.mq4 |
//| Copyright © 2004, MetaQuotes Software Corp. |
//| Modified from LSMA_In_Color to use any MA by Robert Hill |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, FX Sniper and Robert Hill"
#property link "http://www.metaquotes.net/"

//---- indicator settings

#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1 Yellow
#property indicator_color2 LimeGreen
#property indicator_color3 Crimson

extern int MAPeriod=34;
extern int MAType=1;
//added below two lines
input bool EnableSoundAlerts = true;
input string SoundFileName = "alert.wav";

//---- buffers

double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];

//---- variables

int MAMode;
string strMAType;


//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
IndicatorBuffers(3);

//---- drawing settings
SetIndexBuffer(2,ExtMapBuffer1);
SetIndexBuffer(1,ExtMapBuffer2);
SetIndexBuffer(0,ExtMapBuffer3);

SetIndexStyle(2,DRAW_LINE,STYLE_SOLID,4);
SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,4);
SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,4);

switch (MAType)
{
case 1: strMAType="EMA"; MAMode=MODE_EMA; break;
case 2: strMAType="SMMA"; MAMode=MODE_SMMA; break;
case 3: strMAType="LWMA"; MAMode=MODE_LWMA; break;
case 4: strMAType="LSMA"; break;
default: strMAType="SMA"; MAMode=MODE_SMA; break;
}
IndicatorShortName( strMAType+ " (" +MAPeriod + ") ");
//---- initialization done
return(0);
}

double LSMA(int Rperiod, int shift)
{
int i;
double sum;
int length;
double lengthvar;
double tmp;
double wt;

length = Rperiod;

sum = 0;
for(i = length; i >= 1 ; i--)
{
lengthvar = length + 1;
lengthvar /= 3;
tmp = 0;
tmp = ( i - lengthvar)*Close[length-i+shift];
sum+=tmp;
}
wt = sum*6/(length*(length+1));

return(wt);
}

int start()

{

double MA_Cur, MA_Prev;
int limit;
int counted_bars = IndicatorCounted();
//---- check for possible errors
if (counted_bars<0) return(-1);
//---- last counted bar will be recounted
if (counted_bars>0) counted_bars--;
limit = Bars - counted_bars;

for(int i=limit; i>=0; i--)
{
if (MAType == 4)
{
MA_Cur = LSMA(MAPeriod,i);
MA_Prev = LSMA(MAPeriod,i+1);
}
else
{
MA_Cur = iMA(NULL,0,MAPeriod,0,MAMode,PRICE_CLOSE,i);
MA_Prev = iMA(NULL,0,MAPeriod,0,MAMode,PRICE_CLOSE,i+1);
}


//========== COLOR CODING ===========================================

ExtMapBuffer3 = MA_Cur; //red
ExtMapBuffer2 = MA_Cur; //green
ExtMapBuffer1 = MA_Cur; //yellow

if (MA_Prev > MA_Cur)
{
ExtMapBuffer2 = EMPTY_VALUE;
if (EnableSoundAlerts) PlaySound(SoundFileName);

}
else if (MA_Prev < MA_Cur)
{
ExtMapBuffer1 = EMPTY_VALUE; //-1 red/greem tight
if (EnableSoundAlerts) PlaySound(SoundFileName);

}
else
{

ExtMapBuffer1=EMPTY_VALUE;//EMPTY_VALUE;
ExtMapBuffer2=EMPTY_VALUE;//EMPTY_VALUE;
}

}

return(0);
}
//+------------------------------------------------------------------+






Tested, dual colour ma with sound alert with red green signal, yellow prev continue/profit booking & no trade zone.

Hard work referencs:- :D

Collection, idea, testing... headstrong007
Code modification help from...Happy Life@Happy_Singh
Thread owner.. pannet1

------
I set default settings as 34 ema, can set any ma as per your choices..
 
#42
Friends does any one know good mt4 live data for NSE and commodities India
I tried Vcharting demo, its lagging and I couldnt load my indicators
I need speed connection .
 

pannet1

Well-Known Member
#43
Friends does any one know good mt4 live data for NSE and commodities India
I tried Vcharting demo, its lagging and I couldnt load my indicators
I need speed connection .
Priya,

try bpr's excel sheet containing datafeed providers comparision.

http://www.traderji.com/data-feeds/94666-datafeed-vendor-comparison-27.html

There is some time lag depending on how much you pay. You cannot execute trade from Metatrader anyway. So i don't see the point, but its my opinion. Yours may be different.
 

sanju005ind

Investor, Option Writer
#44
@pannet1 / @headstrong007

I was testing MT4.Is there a way to filter for stocks which meet a certain criteria.Like I Scan,Explore in Amibroker.
If so can you please point to a sample code.
 

pannet1

Well-Known Member
#45
@pannet1 / @headstrong007

I was testing MT4.Is there a way to filter for stocks which meet a certain criteria.Like I Scan,Explore in Amibroker.
If so can you please point to a sample code.
if you want signals only, you can use indicators. open all the intruments in seperate chart and put your custom indicator there. you could add alert to it.

if you want to trade your signals, you need to use experts. open all instruments in separate chart and put the expert there.

however its possible to access multiple instruments for both scanning and trading .. but if you are using datafeed (of indian markets), then you use the edge anyway.
 

sanju005ind

Investor, Option Writer
#46
if you want signals only, you can use indicators. open all the intruments in seperate chart and put your custom indicator there. you could add alert to it.

if you want to trade your signals, you need to use experts. open all instruments in separate chart and put the expert there.

however its possible to access multiple instruments for both scanning and trading .. but if you are using datafeed (of indian markets), then you use the edge anyway.
Now In amibroker I have an AFL which I use to "explore" at the end of the day to check all FNO stocks which are between Monthly PP and Monthly R1. I would like to know Is there a way to list all stocks which meets the above criteria in MT4. Dont worry the coding part I can learn it.But is there a way of screening or filtering the stock at one go which will spit out all the stock which meet my criteria.
 

pannet1

Well-Known Member
#47
Now In amibroker I have an AFL which I use to "explore" at the end of the day to check all FNO stocks which are between Monthly PP and Monthly R1. I would like to know Is there a way to list all stocks which meets the above criteria in MT4. Dont worry the coding part I can learn it.But is there a way of screening or filtering the stock at one go which will spit out all the stock which meet my criteria.
you can ...

to give an example... mt4 can show the ma of a list of instruments accross many time frames .. and show buy signal, sell signal or nuetral on a real time basis.

you can search for files that end with mq4 and modify the code as necessary .... most probably the problem you are trying to solve ... is already solved and should be available in public domain.
 

headstrong007

----- Full-Time ----- Day-Trader
#48
Meta Trader is one of the most advanced trading software. You can do it using ExpertAdvisor. You can set auto trade robot using it. You can even trade using it fully automatically from Nest, Now, Odin using bridge software. Everything is possible with MT4/MT5 if you know how to code. :)

Yes, you can scan & explore multiple scripts and multiple time frame from the market watch ( or according to your choice, put script name inside).
Such scanners are not usually free, various scanners are easily available with nominal price. But all such coders give only exe file so difficult to modify or know the code inside. You can contact such coder to make custom based scanners.

You can learn this then contact Happy Singh for help. All types of code reference is present in internet.

If someone can create a simple moving average crossover scanner (along with stochastic crossing or macd crossing optional choice), it could be a great help to most of the traders.
I saw such scanners, some Indian data providers are also providing such scanners, they can arrange custom made if you want. Search the sites.
Example of such scanner [although data with vc charting is not good enough, try to find better provider]
http://www.vcharting.com/scanners.php
probably above site can make the custom scanner, you have contact with them to know.

Using the internet you can find many such scanners but mostly in demo mode (usually works only few forex scripts). You have to contact the author for full version or custom made version.

Some example of scanners:-

https://www.mql5.com/en/market/product/29159#!tab=tab_p_overview

https://www.mql5.com/en/market/product/29146

***********

If someone can create a simple moving average crossover scanner (along with stochastic crossing or macd crossing optional choice inside the settings or we can split it to different scan one each or with two of it and three of it). We can add RSI and super trend too. Someone can make pivot based indicators too, like what you said in more flexible way where we can set a price zone for scanning like the price in between MS2-S2(pivot) or Fibo Pivot price between say 50-61.8%.
If anyone knows how to code MT4 EXPERT ADVISERS to make scanners we can progress. :)

Usually, any scanners automatically work on the chart we apply it, work according to the Time Frame we select from top and scan all script from the market watch or according to the script's code s(usually we can change it from settings).
 
Last edited:

sanju005ind

Investor, Option Writer
#49
Meta Trader is one of the most advanced trading software. You can do it using ExpertAdvisor. You can set auto trade robot using it (even can trade using full automatically from Nest, Now, Odin using bridge software). Everything is possible with MT4/MT5 if you know how to code. :)

Yes, you can scan & explore multiple scripts and multiple time frame from the market watch ( or according to your choice, put script name inside).
Such scanners are not usually free, various scanners are easily available with nominal price. But all such coders give only exe file so difficult to modify or know the code inside. You can contact such coder to make custom based scanners.

You can learn this then contact Happy Singh for help. All types of code reference is present in internet.

If someone can create a simple moving average crossover scanner (along with stochastic crossing or macd crossing optional choice), it could be a great help to most of the traders.
I saw such scanners, some Indian data providers are also providing such scanners, they can arrange custom made if you want. Search the sites.
Example of such scanner [although data with vc charting is not good enough, try to find better provider]
http://www.vcharting.com/scanners.php
probably above site can make the custom scanner, you have contact with them to know.

Using the internet you can find many such scanners but mostly in demo mode (usually works only few forex scripts). You have to contact the author for full version or custom made version.

Some example of scanners:-

https://www.mql5.com/en/market/product/29159#!tab=tab_p_overview

https://www.mql5.com/en/market/product/29146

***********

If someone can create a simple moving average crossover scanner (along with stochastic crossing or macd crossing optional choice inside the settings or we can split it to different scan one each or with two of it and three of it). We can add RSI and super trend too. Someone can make pivot based indicators too, like what you said in more flexible way where we can set a price zone for scanning like the price in between MS2-S2(pivot) or Fibo Pivot price between say 50-61.8%.
If anyone knows how to code MT4 EXPERT ADVISERS to make scanners we can progress. :)

Usually, any scanners automatically work on the chart we apply it, work according to the Time Frame we select from top and scan all script from the market watch or according to the script's code s(usually we can change it from settings).
Thank you very much for the detailed response. Currently I am using Amibroker and have coded some of the AFL's which serve my purpose. Because of the nature of my Trading and my fulltime job at this point I will not be able to utilize Algos . I am underutilizing Amibroker . I just use itto shortlist trading instruments and backtest. I backfill the intradaydata at the end of the day or weekend. Yes I am quick at picking any coding language since I used to teach Java and C++ to corporates 20 years ago. It is really brings joy to code something for yourself and that too trading which I love very much.
 

headstrong007

----- Full-Time ----- Day-Trader
#50
Thank you very much for the detailed response. Currently I am using Amibroker and have coded some of the AFL's which serve my purpose. Because of the nature of my Trading and my fulltime job at this point I will not be able to utilize Algos . I am underutilizing Amibroker . I just use itto shortlist trading instruments and backtest. I backfill the intradaydata at the end of the day or weekend. Yes I am quick at picking any coding language since I used to teach Java and C++ to corporates 20 years ago. It is really brings joy to code something for yourself and that too trading which I love very much.
That's great! Below site will help you. :)

https://book.mql4.com/
 

Similar threads