Please fix this indicator or EA - page 7

[Deleted]  

Forgot to mention! Can somebody help me doing those 2 things

delacroix
58
delacroix  

Where is the EA?

gever17
5
gever17  

Figured it out!

gever17:
Hello All

I need a little help from someone more knowledgeable than I at coding.

I am trying to place a line at the high and the low of the last 20 candles and keep the line moving as the charts flows. I thought it would be a simple task. The result I have now is a line on the current candle high and low. Cant seem to get past it.

I knew absolutely nothing about coding when I found this forum! Thanks to all, I have learned a lot over the last few months. Thank you all for your input and sharing!

I have posted the code and if I can figure out how to do it I will post the file.

Any help would be greatly appreciated!

Thanks for looking!

gever17

Coded as follows:

#property indicator_chart_window

extern int BarsToLookBack = 20;

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

//| Custom indicator initialization function |

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

int init()

{

return(0);

}

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

//| Custom indicator deinitialization function |

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

int deinit()

{

ObjectDelete("highline");

ObjectDelete("lowline");

return(0);

}

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

//| Custom indicator iteration function |

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

int start()

{

int i, c;

ObjectDelete("highline");

ObjectDelete("lowline");

double HighPrice=High[c],

LowPrice =Low[c];

for( i=0, c=0; i<BarsToLookBack; i++, c++)

{

if(High>HighPrice) HighPrice=High[c];

ObjectCreate("highline",OBJ_HLINE,0,0,HighPrice);

ObjectSet("highline",OBJPROP_COLOR,DeepPink);

ObjectSet("highline",OBJPROP_WIDTH,1);

ObjectSet("highline",OBJPROP_STYLE,4);

if(Low>LowPrice) LowPrice=Low[c];

ObjectCreate("lowline",OBJ_HLINE,0,0,LowPrice);

ObjectSet("lowline",OBJPROP_COLOR,Chartreuse);

ObjectSet("lowline",OBJPROP_WIDTH,1);

ObjectSet("lowline",OBJPROP_STYLE,4);

}

return(0);

}

I figured out how to code this indicator. I am posting it for anyone who this may interest. It shows the high price and the low price for X (definable) bars in history. So if you are on a 5 min chart and you want to see the high and low of the last 20 bars on the 15 min chart, set the BarsToLookBack in the inputs to 60(20 bars and 5x3=15, so 20x3=60). For a 60 min chart form the 5 min BarsToLookBack would be set to 240.

Hope it helps!

Happy trading!

gever17

MFM
22
MFM  

help with coding

Hi there, i am trying to code an IB and OB in MT4 but I want it to ignore sunday candles in both cases. Meaning the IB must not be a sunday bar and the OB must not cover a sunday bar.

For example the 16th of november on GBPJPY was a Monday bar which is outside bar to Sunday. So, that can be ignored, but in reality, it is an inside bar to friday, and that is not signaled.

I would like the indicator to do this:

If the day of the week is monday, use friday data to tell me if it is an inside or outside bar in respect to friday. Do not consider sunday

I am attaching the indie i have created so far.

Thanks,

Michael

Files:
trader91
25
trader91  

I can't make _stocNR.mq4 !

Hello to all,

I found this indicator to I can not get it running properly on the filter "sens". when I put a value other than 0 to reduce noise stoch, nothing happens???

Somebody can help me please?

Thanks very much...

Files:
_stochnr.mq4 4 kb
Robert
418
Robert  
trader91:
Hello to all,

I found this indicator to I can not get it running properly on the filter "sens". when I put a value other than 0 to reduce noise stoch, nothing happens???

Somebody can help me please?

Thanks very much...

Hi Trader91,

First, I'm just a novice coder, but I may be able to help you a little.

I took a quick look at your code - it seems that it may not be actually getting the Stoch values?

Here is some Stoch code I pulled from a Stoch EA here on TSD...and it looks quite different than your code which may be missing some values - you have 5, the iStochastic code below has 9. I would suggest trying to match the keywords with this code to your EA.

double StochMain = iStochastic(NULL,0,kp,dp,sl,MODE_SMMA,0,MODE_MAIN,0);

double StochSignal = iStochastic(NULL,0,kp,dp,sl,MODE_SMMA,0,MODE_SIGNAL,0);

It also helps to comment or print out your values to see if it's doing what you want:

Comment(

"\n Main = " , Main,

"\n Stoch = ", Kperiod, " " ,Slowing, " ", PriceFild, " " , sens, " ",i ,

"\n StochMain = ",iStochastic(NULL,0,kp,dp,sl,MODE_SMMA,0,MODE_MAIN,0),

"\n StochSignal = ",iStochastic(NULL,0,kp,dp,sl,MODE_SMMA,0,MODE_SIGNAL,0),

"\n "

);

Hope this helps get you back on track.

Robert

Sachmo
6
Sachmo  

Need help with first EA

Hello

I am working on my first EA and I am a complete beginner.

So, I would be very happy if somebody could help me with the code.

I have a simple EMA crossover EA and would like to include the attached Flat Trend RSI indicator.

What would be the correct code for the Flat Trend RSI indicator to:

only buy after a EMA cross if the indicator is blue (uptrend) and

only sell after EMA cross if the indicator is red (downtrend).

Thanks a lot in advance

Sachmo

Files:
McBenjamin
22
McBenjamin  

Modification to EMA Cross Over

I need someone to please help me modify this EA to automatically close all open positions for the particular instrument that it's being applied to after every cross over alert. Thanks in advance.

#property copyright "Coders Guru"

#property link "https://www.forex-tsd.com"

#property indicator_chart_window

#property indicator_buffers 2

#property indicator_color1 Blue

#property indicator_color2 Red

extern int FasterMA = 5;

extern int SlowerMA = 10;

//---- buffers

double ExtMapBuffer1[];

double ExtMapBuffer2[];

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

//| Custom indicator initialization function |

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

int init()

{

//---- indicators

SetIndexStyle(0,DRAW_LINE);

SetIndexBuffer(0,ExtMapBuffer1);

SetIndexStyle(1,DRAW_LINE);

SetIndexBuffer(1,ExtMapBuffer2);

//----

return(0);

}

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

//| Custor indicator deinitialization function |

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

int deinit()

{

//----

//----

return(0);

}

bool Crossed (double line1 , double line2 )

{

static string last_direction = "";

string current_dirction = "";

if(line1>line2)current_dirction = "up";

if(line1<=line2)current_dirction = "down";

if(current_dirction != last_direction)

{

Alert("EMA Cross for "+Symbol()+" on the "+Period()+" minute chart.");

last_direction = current_dirction;

return (true);

}

else

{

return (false);

}

}

int start()

{

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--;

int pos=Bars-counted_bars;

while(pos>=0)

{

ExtMapBuffer1[pos]= iMA(NULL,0,5,0,MODE_EMA,PRICE_CLOSE,pos);

ExtMapBuffer2[pos]= iMA(NULL,0,10,0,MODE_EMA,PRICE_CLOSE,pos);

pos--;

}

Print(Crossed (ExtMapBuffer1[0],ExtMapBuffer2[0]));

//----

return(0);

}

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

marytan30
330
marytan30  

High probability Trading System

hi,

i need someone to help me to improve this EA , I have been using it for quite sometime and it looks good this system is developed by a chief Forex strategist.

This EA is suitable for London and US trading time only.

What i need is someone to add time trading trigger for this EA and also to disabled the EA once a stop loss or take profit is hit.

Files:
lea_31
3
lea_31  

The safe way to do martingale

Hi,

I think that if we use a smal stoploss like 20 or 30 pips and bigger takeprofit like 80 or 100 pips, the martinale become very safe withe this kind of chain for lots : {0.1, 0.1, 0.1, 0.1, 0.1, 0.2, 0.2, 0.3, 0.3, 0.4, 0.5, 0.6, 0.8, 1, 1.2, 1.5, 1.9, 2.4, 3, 3.7}.

It will be great if someone can change the lot value in the ea attached below to use this chain instead of the double one used in it.

Files: