MQL4 Learning - page 113

 

iBarShift Question

Hello,

I want to get the Number of bars from the actual time to 6 o'clock from the actual day.

I thought I can use the iBarShift-Function, but what do I have to write for the "time-Parameter"??

iBarShift(NULL,0,6)

Lot's of thanks, sunshine

 
sunshineh:
Hello,

I want to get the Number of bars from the actual time to 6 o'clock from the actual day.

I thought I can use the iBarShift-Function, but what do I have to write for the "time-Parameter"??

iBarShift(NULL,0,6)

Lot's of thanks, sunshine

This will be like that:

iBarShift(NULL,0,StrToTime("06:00"));

 

Need Help

I am looking for just a simple EA, which use on any candle chart, if previous candle is red it open sell trade (or vice versa) so for example a sell trade is open and next candle is blue, so buy trade will open, and go on... it means multiple trades will open (buy/sell) all positions will be open until close all manually. Sorry about my english...

Position will open at the close of bar (not in between).

I had seen this type of EA somewhere in the forum but cant relocate now.

Can anyone please help me

I really appreciate THANKSSS REGARDS

ZAIBA

 

Indicator call Script?

Does anyone know if an MT4 indicator can call or spawn a script?

 

Help!Please make Ea 4 digit broker to 5 digits

Hello,Please make Ea 4 digit broker to 5 digits

Deposit Files

Thank you.

 

Open your EA in metaEditor and after

extern double TakeProfit = 10.0;

extern double StopLoss = 30.0;

insert:

extern double PointRatio = 10;

double _Point;

after

int init()

before

{

insert:

_Point = Point * PointRatio;

Use 'Edit - Find' menue in MetaEditor to find all the word

Point

and change those words inside the code to

_Point

Save and compile (or save by renaming the EA that is better to do).

PointRatio = 10 in the settings = 5 digit.

1 is 4 digit.

That's all.

Same with any indicator.

----------

There are the codes for automatically checking - 4 or 5 digit but I do not know them sorry.

 
newdigital:
Open your EA in metaEditor and after

extern double TakeProfit = 10.0;

extern double StopLoss = 30.0;

insert:

extern double PointRatio = 10;

double _Point;

after

int init()

before

{

insert:

_Point = Point * PointRatio;

Use 'Edit - Find' menue in MetaEditor to find all the word

Point

and change those words inside the code to

_Point

Save and compile (or save by renaming the EA that is better to do).

PointRatio = 10 in the settings = 5 digit.

1 is 4 digit.

That's all.

Same with any indicator.

----------

There are the codes for automatically checking - 4 or 5 digit but I do not know them sorry.

----------------------------------------------------------------------

Thank you, thank you, I did everything.

 

Custom array MACD

Hi all,

I'm trying to construct a MACD on a custom array. I have this code for a standard MACD...

int limit;

int counted_bars=IndicatorCounted();

//---- last counted bar will be recounted

if(counted_bars>0) counted_bars--;

limit=Bars-counted_bars;

//---- macd counted in the 1-st buffer

for(int i=0; i<limit; i++)

MacdBuffer=iMA(NULL,0,FastEMA,0,MODE_EMA,PRICE_CLOSE,i)-iMA(NULL,0,SlowEMA,0,MODE_EMA,PRICE_CLOSE,i);

//---- signal line counted in the 2-nd buffer

for(i=0; i<limit; i++)

SignalBuffer=iMAOnArray(MacdBuffer,Bars,SignalSMA,0,MODE_SMA,i);

Since I am not using one of the standard arrays(close, open, high, low) I can't use iMA . So, as a test, what I *tried* was to convert this code to use iMAOnArray. like this...

int limit;

int counted_bars=IndicatorCounted();

if(counted_bars>0) counted_bars--;

limit=Bars-counted_bars;

double MacdBuffer[];

double copyClose[];

ArrayResize(copyClose,Bars);

ArrayResize(MacdBuffer,Bars);

ArrayCopy(copyClose, Close);

for(int i=0; i<limit; i++) {

MacdBuffer = iMAOnArray(copyClose,0,FastEMA,0,MODE_EMA,i) - iMAOnArray(copyClose,0,SlowEMA,0,MODE_EMA,i);

ssl=MacdBuffer;

}

On the surface, it seems like it would work but the resulting graph does not match the MACD line for the first code snippet. I'm wondering what I'm doing wrong or, perhaps, if there's another path I should be going down entirely. Could use some help on this.

Much appreciation in advance.

 

If it's entirely different, then you perhaps need ArraySetAsSeries.

 

Keep track of open trades !!

Hello,

I am trying to make a function to keep track of open trades so as to avoid place pending orders on the zone around those open trades, the zone can be defined by the spread and the stoplevel.

so if I have an open buy or sell, I don't want to place a pending order around these open trades, and i can have up to 20 buy and sell at a time .

any ideas or suggestions on how to approach this problem?

Thanks,

ICON

Reason: