Forex



Go Back   Forex Trading > Training > Metatrader > Metatrader 4 mql 4 - Development course > Questions
Forex Forum Register More recent Blogs Calendar Advertising Others Help






Register
Welcome to Forex-TSD!, one of the largest Forex forums worldwide, where you will be able to find the most complete and reliable Forex information imaginable.

From the list below, select the forum that you want to visit and register to post, as many times you want. It’s absolutely free. Click here for registering on Forex-TSD.

Exclusive Forum
The Exclusive Forum is the only paid section. Once you subscribe, you will get free access to real cutting-edge Trading Systems (automated and not), Indicators, Signals, Articles, etc., that will help and guide you, in ways that you could only imagine, with your Forex trading.
  • Elite Section
    Get access to private discussions, specialized support, indicators and trading systems reported every week.
  • Advanced Elite Section
    For professional traders, trading system developers and any other member who may need to use and/or convert, the most cutting-edge exclusive indicators and trading systems for MT4 and MT5.
See more

Reply
 
Thread Tools Display Modes
  #991 (permalink)  
Old 02-24-2008, 07:08 PM
Junior Member
 
Join Date: Jan 2008
Posts: 24
SimonF is on a distinguished road
Quote:
Originally Posted by Big Be View Post
WHEN do you want to use a STATIC variable - what problems can it solve?

WHEN do you want to put something in the INIT() section - what problems does it solve?

Big Be
A static variable will remain the same with every function call that that variable is in, unless it's changed in the function of course. You may want an integer in that function only that you want to increase by 1 for example every function call.

But, you could aswell use global variables for this.

Example of init:

int init() {
TakeProfit=TakeProfit*Point;
StopLoss=StopLoss*Point;
TrailingStop=TrailingStop*Point;
breakEven=breakEven*Point;

return(0);
}

These are extern variables and you set takeprofit to 50 for example if you want 50 pips. But for this to work in the EA it must be multiplicated with the pip value of the currency 0.001 for example.
__________________
boo

Last edited by SimonF; 02-24-2008 at 07:10 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #992 (permalink)  
Old 02-24-2008, 08:15 PM
Member
 
Join Date: Oct 2006
Posts: 80
Big Be is on a distinguished road
re: Coding Knowledge Questions

Quote:
Originally Posted by SimonF View Post
A static variable will remain the same with every function call that that variable is in, unless it's changed in the function of course. You may want an integer in that function only that you want to increase by 1 for example every function call.

But, you could aswell use global variables for this.
...
Simon-
Thanks. Please help make it clear:

Does this mean a static variable holds the last value assigned to it even though it is not global?

Regarding init(), it looks like it is used as a setup function.
- Can you tell me other good examples for it?

- Do you have to follow it with deinit()?

Big Be
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #993 (permalink)  
Old 02-26-2008, 12:06 PM
Junior Member
 
Join Date: Dec 2006
Posts: 2
sodipo200 is on a distinguished road
Ask

Quote:
Originally Posted by codersguru View Post
Hi folks,

I've got a lot of private messages asking me for helping with some pieces of code.

Here you can post your questions related to MQL4, and I'll do my best to answer them.
Hello,
I want to learn mql directly from you i have read your tutorial and i have been coding couple of EA.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #994 (permalink)  
Old 02-28-2008, 07:22 AM
Junior Member
 
Join Date: Oct 2007
Posts: 14
yappe is on a distinguished road
ma color based on closing

HI,

is there any ma indicator that color change according to the close of the candle.For example if the candle close above SMA then the line color is blue but if below MA then the color will change to red.
I know there is a indicator that has called "ma_in_color.mq4" sorry but i don't know how to post it, my question is, of there is anybody out there, who could program an sound alert in this indicator.

thx a lot
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #995 (permalink)  
Old 02-29-2008, 05:02 AM
Senior Member
 
Join Date: Oct 2007
Posts: 230
Dave137 is on a distinguished road
Question

What is the easiest way to get the buffer values of an indicator to either display as a comment or print out in the experts folder so I can see the values change?? I have 8 buffers in this indicator.

Dave
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #996 (permalink)  
Old 02-29-2008, 05:04 AM
ralph.ronnquist's Avatar
Senior Member
 
Join Date: Oct 2006
Posts: 297
ralph.ronnquist is on a distinguished road
ctrl-D .
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #997 (permalink)  
Old 02-29-2008, 05:32 AM
Senior Member
 
Join Date: Oct 2007
Posts: 230
Dave137 is on a distinguished road
Smile

Thanks!

Dave
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #998 (permalink)  
Old 03-01-2008, 04:57 PM
Junior Member
 
Join Date: Jan 2008
Posts: 24
SimonF is on a distinguished road
Quote:
Originally Posted by Big Be View Post
Does this mean a static variable holds the last value assigned to it even though it is not global?
Yes, but it can be used inside of that function only. You can have global variables with the same name as the static variable (I'm 99% sure), but it's good use not too, so you don't mix things up.

The other questions someone else might want to answer as I'm not sure.
__________________
boo
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #999 (permalink)  
Old 03-02-2008, 09:46 PM
Junior Member
 
Join Date: Aug 2007
Posts: 8
dan5767 is on a distinguished road
Limit orders per bar

Hi I have a quick question. Im trying to code an EA where I will only be able to open one trade per bar. So when I use the 1H timeframe I can only open one order. I tried to add this line to limit the amount of orders, but it does not work.

TimeCurrent()-OrderCloseTime()>60*60

Thanks!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #1000 (permalink)  
Old 03-04-2008, 12:04 PM
Junior Member
 
Join Date: Feb 2008
Posts: 4
danielp is on a distinguished road
How to change alert into trading EA

Hi Guys,
How do you change an alert indicator into a trading EA?
I've tried changing the command Alert(Symbol()+" "+Period()+" XO Long ",Bid); into OrderSend(Symbol(),OP_BUY,0.01,Ask,3,20,20,"XO-CCI",1,0,Blue); at the start I chose menu to make EA, then content of my alert indicator, i copied to this EA, then I changed the command alert to trading command as above, then i compiled. But the compiled EA is not making any trade after i tried it on 1M chart for a day.

Please help.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
Reply

Bookmarks

Tags
forex, histogram, JMASlope, ToR 1.20, ZUP_v1.mq4


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump


All times are GMT. The time now is 06:54 AM.



Search Engine Friendly URLs by vBSEO 3.2.0 ©2008, Crawlability, Inc.