MQL4 Learning - page 79

 

Indicator of the indicator

Hi guys, do you know of an indicator that will compute and plot chart of an indicator?

the formula is this:

[TODAY'S READING - LOWEST READING(say in the last 20days)]

--------------------------------------------------------------------------------------- X 100

variables are:

var1: any indicator e.g. CCI, RSI, ADX, MFI, Stochs etc

var2: last X days

any ideas guys?

thanks for any help.

 

unknown subwindow number -1 for ObjectCreate function

Got this error on the tester by calling a custom indicator via iCustom. The result of the iCustom was OK. Any idea why it happens and how to solve it?

Many thanks in advance

 

OrderSelect gives weird result in strategy tester

hi! i've been writing an EA. and i noticed that OrderSelect wasn't acting as it should. so i wrote a simple test program, and OrderSelect still gives a strange result.

consider the following code:

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

{

if(OrderSelect(i, SELECT_BY_POS, MODE_HISTORY))

{

Print("OrderTicket: ", OrderTicket());

}

}

Lets say that 5 trades have been opened and closed. the above fragment of code should print out the ticket number of those 5 trades. however, it only prints the first. OrderSelect fails and returns Error 0 for the others (Error 0 actually means "no error", so OrderSelect fails with "no error"?!). i have attached the test code which incorporates the above.

i spent 12 hours trying to figure this out so far. any assistance would be appreciated.

Files:
 

You must use

OrderSelect(i, SELECT_BY_POS, MODE_TRADES )

with OrdersTotal()

and

OrderSelect(i, SELECT_BY_POS, MODE_HISTORY)

with OrdersHistoryTotal( )

You can find more info in Metaeditor's help.

Regards.

 
smartman:
You must use

OrderSelect(i, SELECT_BY_POS, MODE_TRADES )

with OrdersTotal()

and

OrderSelect(i, SELECT_BY_POS, MODE_HISTORY)

with OrdersHistoryTotal( )

You can find more info in Metaeditor's help.

Regards.

you have rescued me from the brink of insanity! thanks!

 
kiss987@gmail.com:
Got this error on the tester by calling a custom indicator via iCustom. The result of the iCustom was OK. Any idea why it happens and how to solve it? Many thanks in advance

The 'problem' is with the indicator not your EA. The indicator is looking to draw in the first indicator window (the main window is 0). If the window doesn't exist, as in your case, you get a warning. You can either fix the issue in the indicator or just ignore it.

Lux

 

Help Coding a New Indicator

Hi,

(1st time poster

I'm looking for a friendly mql coder who could have a look at producing this indicator / alert based on pre-defined criteria.

All Im looking for is a visual alert on the chart (arrow above or below the criteria, with the ability to send and email if required).

The criteria are based exactly on Tom Striganos "Catapult for 80" setup, exact details are

www.strignanosforexsignals.com/catapult80.pdf

Summary of the above PDF link.

Catapult for 80 upside

Two important criteria, One: the bar before the execution bar must be a lower high(Green

Arrow) then the previous bar. Two the close must be a Down close. if you have met the

criteria you buy the top of the bar two bars ago.. Stop loss 15 pips below the middle

bar .Look for 80 pips, use market exhaustion..fibs all the tools you have been given.

Catapult For 80 Set up for the Down side.

Two important criteria One

The bar before execution has to be a low greater the the previous Bar.

Second Criteria You need a up Close. If you have Met the Criteria you sell the

bottom of the Bar (Two Bars ago.) Stop Loss 15 pips above the middle bar.

Red arrow on top. Look for 80 pips. 80 pips is what we are going for if it breaks below, use a

trailing stop, of course you can use Fibs as well to calculate exhaustion.

Any help much appreciated.

Thanks.

 

Formula required, please advise...

I am trying to put my MT4 system into my website.

I require the forumula for MT4 IMA() array moving average types called...

MODE_SMMA - Smoothed moving average

MODE_LWMA - Linear weighted moving average.

Please advise..thx

 

See Forex Trading Software: Forex Trading Platform MetaTrader 4

You will found all indicator formulas.

 

I wrote something today but it doesn't work as it should.

For long position everythig is fine (it doesn't modify short one).

for(cnt=0;cnt<total;cnt++)

{

OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);

if(OrderType()<=OP_SELL && OrderSymbol()==Symbol())

{

if(OrderType()==OP_BUY)

{

//IT WORKS:

if(Close[1]-Open[1]>0 && High[1]>P_BUY && Low[1]>D_BUY)

{

P_BUY=High[1];

D_BUY=Low[1];

OrderModify(OrderTicket(),OrderOpenPrice(),Low[1]-Point*1,OrderTakeProfit(),0,Green);

return(0);

}

}

else

{

//IT DOESN'T:

if(Close[1]-Open[1]<0 && High[1]<P_SELL && Low[1]<D_SELL)

{

P_SELL=High[1];

D_SELL=Low[1];

OrderModify(OrderTicket(),OrderOpenPrice(),High[1]+(Spread+1)*Point,OrderTakeProfit(),0,Red);

return(0);

}

}

}

}

Any ideas??

Reason: