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
  #441 (permalink)  
Old 12-14-2006, 09:07 PM
Junior Member
 
Join Date: Oct 2006
Posts: 1
trader1234 is on a distinguished road
Very Simple Indicator

Hi Codersguru,

I have no experience with MQL4 language, but i need a very simple yet time saving indicator.

I need to develope an indicator that will draw a horizontal line based on some arithmetic calculations. (ie. Like a camarilla indicator, except the lines do not need to be re-drawn or updated, they will be fixed).

All i need is a simple example of how to do this in the coding, and I will be able to do the rest on my own.

For example,
{
Line1 = 1+1
Draw Line1
}

I know this sounds simple, but i just don't know how to do the initial setup and getting a horizontal line drawn on my chart.

Of course there will be much more calculations and equations to this indicator, but a simple example and setup would be greatly appreciated.

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
  #442 (permalink)  
Old 12-15-2006, 07:30 AM
fotovat's Avatar
Member
 
Join Date: May 2006
Posts: 79
fotovat is on a distinguished road
Quote:
Originally Posted by majlisb
HI, professional

in example In an Ea we get a signal and we want to place a BUYSTOP/SellStop Order in hight of the signal bar,

We should wait to new bar open to find the Hight of signal bar , How we can do this ? (any article , post, EA , , , )



Thanks
If you count 3bars for signal now count 4bars simply yes ? Codersguru has a nice article about another way in mql4 site
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
  #443 (permalink)  
Old 12-18-2006, 10:57 PM
Senior Member
 
Join Date: Oct 2006
Posts: 206
aegis is on a distinguished road
I have a question:

This may require some additional programming that can't be done on MT. Not sure. Basically, I have an EA that both backtests and forward tests well in MT with Alpari data. On other broker's datafeeds, there is often a discrepancy between trades. Sometimes, if a trade is opened on Alpari, it may not be opened with a different broker or vice versa. Is it possible to write some kind of script that will execute trades on my broker's platform just after a trade is executed on Alpari's platform?

For example, I get a signal to buy 2 lots of cable at 1.9450 on Alpari. The trade is executed. That same order is then entered on my live broker's platform a split second later. When a stop or t/p level is hit on Alpari and the trade is closed, that same trade is then closed on my live broker's platform.

This is not a scalping system, so if there is a 2 pip discrepancy between the two prices, it's not a big deal. Does anyone know if this is possible, and if so, how do I go about doing it? Thank you.
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
  #444 (permalink)  
Old 12-19-2006, 02:35 PM
Pippt's Avatar
Member
 
Join Date: Feb 2006
Location: Lisboa - Portugal
Posts: 33
Pippt is on a distinguished road
Help with MTF xpMA

Codersguru,

Can you please check MTF capabilities of xpMA?

Many Thanks,

Pippt

Please see post #364 at:

Multi Timeframe Indicators
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
  #445 (permalink)  
Old 12-20-2006, 05:44 AM
BluePearl's Avatar
Senior Member
 
Join Date: Oct 2005
Posts: 206
BluePearl is on a distinguished road
simple question but i can't figure it out. what math function in mql is used to round out a double value?

say for example, i've got 0.69 and i want the result to be .70. or if the value is .63 and the result would be .60.

the mathceiling() and mathfloor() do not do the trick.
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
  #446 (permalink)  
Old 01-01-2007, 05:33 AM
Junior Member
 
Join Date: Dec 2006
Posts: 5
chief1oar is on a distinguished road
Question Beginners Question

Hello everyone...

Thanks to CodersGuru and his excellent course, I am attempting to learn MQL4
by converting an indicator I wrote in MQL3.

I have run into a snag and would appreciate some help... if someone could please tell me what I am doing wrong in the following code.

The problem is in the 2 If statements... at line 78 & 79

//+------------------------------------------------------------------+
//| First_Indicator.mq4 |
//| Codersguru |
//| http://www.forex-tsd.com |
//+------------------------------------------------------------------+
#property copyright "Codersguru"
#property link "http://www.forex-tsd.com"
#property indicator_chart_window
#property indicator_buffers 8
#property indicator_color1 Red
//---- buffers
double ExtMapBuffer1[];

//----------------- Variable Declarations ----------------------+
int pos=0;

double Pivot_Point = 0;
double new_Pivot_Point =0;
double prev_Pivot_Point=0;
double Pivot_Factor=0;
double LastClose=0;

//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,1);
SetIndexBuffer(0,ExtMapBuffer1);
string short_name = "Pivot Line";
IndicatorShortName(short_name);
return(1);
}

//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
return(0);
}

//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
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 cnt=Bars-counted_bars;

//---- main calculation loop
while(cnt >= 0)
{
LastClose = Close[cnt];
If (LastClose > Pivot_Point) //Line 78
If(new_Pivot_Point > prev_Pivot_Point) //Line 79
{
prev_Pivot_Point = new_Pivot_Point;
Pivot_Point = new_Pivot_Point;
}

ExtMapBuffer1[cnt]= Pivot_Point ;
cnt--;
}
return(0);
}

These are the compiler messages -
---------------------------------------------------------------
'If' - function is not defined .....(78,10)
'If' - semicolon expected .....(79,13)
'If' - function is not defined ...(79, 13)
'{' - semicolon expected ....(80, 13)
----------------------------------------------------------------

No matter what I do, I can't seem to come up with what the problem is... I know it is very simple, but it is escaping me...


Thanks to all who can assist in this basic question....

Chief

P.S. Happy, Healthy, Prosperous New Year to ALL
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
  #447 (permalink)  
Old 01-01-2007, 05:37 AM
ralph.ronnquist's Avatar
Senior Member
 
Join Date: Oct 2006
Posts: 297
ralph.ronnquist is on a distinguished road
Re: Beginners Question

MQL is case sensitive: use "if" instead of "If".
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
  #448 (permalink)  
Old 01-01-2007, 05:44 AM
Junior Member
 
Join Date: Dec 2006
Posts: 5
chief1oar is on a distinguished road
Smile re: Beginners Question

WOW... that was Fast....

THANK YOU so much for the fast reply... solved it...

your response is so very appreciated... have a great new year...

Chief
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
  #449 (permalink)  
Old 01-01-2007, 10:40 AM
ralph.ronnquist's Avatar
Senior Member
 
Join Date: Oct 2006
Posts: 297
ralph.ronnquist is on a distinguished road
MathRound

Quote:
Originally Posted by BluePearl
simple question but i can't figure it out. what math function in mql is used to round out a double value?

say for example, i've got 0.69 and i want the result to be .70. or if the value is .63 and the result would be .60.

the mathceiling() and mathfloor() do not do the trick.
There's "MathRound(double x)" which rounds a value to its nearest integer; same as "MathFloor(x+0.5)", I suppose. To get rounding to one decimal you can use a decimal shift/unshift expression like "MathRound(x*10)/10".
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
  #450 (permalink)  
Old 01-02-2007, 05:09 AM
increase's Avatar
Senior Member
 
Join Date: May 2006
Posts: 844
increase is on a distinguished road
How can I add arrows to the attached to show up and down at the cross?
Attached Files
File Type: mq4 #MTF cross.mq4 (4.1 KB, 33 views)
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 09:34 AM.



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