MQL4 Learning - page 8

 

Challenge : how do I code a text grid

I wish to post via Comment() function on the screen for data in a chart a grid like this

................1 2 3 4 5 6 7 8 9 10 11 12

Year 2007

Year 2006

year 2005

Year by month, and I will but in it Highest close for a symbol.

Both year and month should be based on data in chart ...

So how would I run thru price data to find years and months, and build and array of the results, then create a string for comments.

Would I run the function in init() or start(). If you run things in init() dont they only run once, rather than every tick update , dunno !

 

switching between timeframes

Hi

I'm trying to program an expert advisor, which runs on a daily chart, and when certain conditions are satisfied it checks for indicator values in the hourly timeframe, which when satisfied, opens an order.

Can someone please help me with switching between timeframes...

Currently, the my expert advisor has 4 indicators running on daily timeframe and 2 on hourly.

But when I test in strategy tester using daily timeframe, it doesnt open any orders.

how do i use multiple timeframe?

Thanks...

 

Code executing only at periodicity

The following code only seems to issue a trade at the periodicity

interval. BuyCond1 && BuyCond2 triggers a buy. Anyone know why?

extern double RSIBuyLevel = 50;

FMA1 = iMA(Symbol(),TimeFrame,FastMAPeriod,0,MODE_EMA,PRICE_CLOSE,0);

SMA1 = iMA(Symbol(),TimeFrame,SlowMAPeriod,0,MODE_SMA,PRICE_CLOSE,0);

RSI1 = iRSI(Symbol(),TimeFrame,RSIPeriod,PRICE_CLOSE,0);

BuyCond1=FMA1 > SMA1;

BuyCond2= RSI1 > RSIBuyLevel;

 

Array of values to a function (external)

Suppose I want to pass an array of values to an external function (say to use an external technical library). Is there an easy way to say "pass last 60 close bars to function A"? And what would the code look like on the dll to accept the array?

 

ObjectCreate

ObjectCreate(TLine1, OBJ_TREND, 0, Time[25], Bid, Time[0], Ask);

Need Bid to be myvariable and Ask myothervariable

Just cant get it, believe me Ive tried

I know I have to define myvariables but everything I have tried failed

 

Dear Experts Advisers! please advise on this:

Dear Experts Advisors!

Please, stupid simple question: How to change indicator's layers on the chart and in separate windows (bring it from bottom to the front) and sequence of indicators frames (bottom to the top)?

Is it del &paste the only method, no easy hacks?

 

hello,

thank you to all that had answer me.

Now I have learn C/C++ with a german book and I hope to learn MQL4 will no longer be so difficult.

kinds regards

echi

 

Need a little help to add code to EA.

I was wondering if somone that knows how to code EA's add some code to an existing EA. The EA is the MACD Sample that comes with the metatrader platform. Presently, it does not have a stoploss or money management aspect so I can risk a percentage of my equity/balance. I would like to add these. I am no programmer and I have tried several times to add these but get errors I cannot fix. This is probably very simple for someone that knows MQL. Any help would be appreciated. Thanks in advance.

Kevin

 

Function For everyone....

Here are a few functions that once created can help everyone. Just need someone to code them....

Take a look at the attached pictures.

The goals are to

1. Enter your position at the best possible location on the bar. This should help everyone squeeze a few more pips out of every trade. Uses a timer or countdown.

2. Is a 2 tiered trailing stop that manages multipl orders. Would work good for protecting profit in margintale systems.

3. Is just nessacary for calculating indicators. Meaning that a big problem with indicators that calculate from previous data is that time is not considered. the plan is to start the indicator at a certian time rather than a specifice number of periods back.

Just pics and ideas but thats how it all starts.

Thanks for your help in advance.

K

 

EAs with tight stop losses

Can someone recommend some good EAs that work with stop losses of 30 pips or less? Thanks.