Forex
Google
New signals service!

Go Back   Forex Trading > Metatrader Training > Metatrader 4 mql 4 - Development course > Questions


Register in Forex TSD!
Trading Systems Leaders in this forum (automated trading systems) are winning more than 3000 pips in a month (30000$ investing one lot every time).
Click here to register and get more information

Reply
 
LinkBack (2) Thread Tools Display Modes
  #61 (permalink)  
Old 01-05-2006, 02:02 PM
kamyar's Avatar
Senior Member
 
Join Date: Dec 2005
Location: Iran
Posts: 635
kamyar is on a distinguished road
hi coder

i am trying to make an indicatore that shows parabolic sar dots of the m15,m30,h1 time frames together in one chart but i have som problems can you help me?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #62 (permalink)  
Old 01-08-2006, 10:04 PM
camisa's Avatar
Senior Member
 
Join Date: Dec 2005
Location: Portugal
Posts: 228
camisa is on a distinguished road
Hi, I've attached an indicator in mq4 that alerts whenever cci<-150

It alerts in a tick by tick basis; can anyone modify it so it only alerts at close of the candle?

In this case I would only like to be alerted when cci is < -150 at the end of a 5m candle

Thanks in advance
Attached Files
File Type: mq4 RD CCI Buy.mq4 (8.6 KB, 86 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #63 (permalink)  
Old 01-10-2006, 02:06 PM
camisa's Avatar
Senior Member
 
Join Date: Dec 2005
Location: Portugal
Posts: 228
camisa is on a distinguished road
ok, 2nd question, i think this one is easy:

I'm building a user indicator to alert me when price close crosses a MA

I'm using the iCustom to import the MA indicator


and then I don't know how to use the price close; i tried CLOSE and PRICE_CLOSE but with no results:

if (CLOSE?>ma1)
adxvalue= -1;

if (PRICE_CLOSE?>ma1)
adxvalue= -1;

Also, I want the alert to sound only at the end of a 5m bar and not work on a tick by tick basis: what else should I change (this question is the one in my previous post)

Thanks
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #64 (permalink)  
Old 01-16-2006, 09:28 AM
Junior Member
 
Join Date: Jan 2006
Posts: 1
dccooper is on a distinguished road
Hi Codersguru,

Could you help me code an alert into Osma Color so that it alerts when the colors change.

Thanks

Duncan

//+------------------------------------------------------------------+
//| OsMA_color.mq4 |
//| Rafael |
//| marynarz15@wp.pl |
//+------------------------------------------------------------------+
#property copyright "Rafael"
#property link "marynarz15@wp.pl"
//---- indicator settings
#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 Lime
#property indicator_color2 Red

//---- indicator parameters
extern int FastEMA=12;
extern int SlowEMA=26;
extern int SignalSMA=9;
//---- indicator buffers
double ind_buffer1a[];
double ind_buffer1b[];
double ind_buffer2[];
double ind_buffer3[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- 2 additional buffers are used for counting.
IndicatorBuffers(4);
//---- drawing settings
SetIndexStyle(0,DRAW_HISTOGRAM,STYLE_SOLID,2);
SetIndexStyle(1,DRAW_HISTOGRAM,STYLE_SOLID,2);
SetIndexDrawBegin(0,SignalSMA);
SetIndexDrawBegin(1,SignalSMA);
IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS)+2 );
//---- 3 indicator buffers mapping
if(!SetIndexBuffer(0,ind_buffer1a) &&
!SetIndexBuffer(1,ind_buffer1b) &&
!SetIndexBuffer(2,ind_buffer2) &&
!SetIndexBuffer(3,ind_buffer3))
Print("cannot set indicator buffers!");
//---- name for DataWindow and indicator subwindow label
IndicatorShortName("OsMA("+FastEMA+","+SlowEMA+"," +SignalSMA+")");
//---- initialization done
return(0);
}
//+------------------------------------------------------------------+
//| Moving Average of Oscillator |
//+------------------------------------------------------------------+
int start()
{
int limit;
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--;
limit=Bars-counted_bars;
//---- macd counted in the 1-st additional buffer
for(int i=0; i<limit; i++)
ind_buffer2[i]=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 additional buffer
for(i=0; i<limit; i++)
ind_buffer3[i]=iMAOnArray(ind_buffer2,Bars,SignalSMA,0,MODE_SMA, i);
//---- main loop
double value=0;
for(i=0; i<limit; i++)
{
ind_buffer1a[i]=0.0;
ind_buffer1b[i]=0.0;
value=ind_buffer2[i]-ind_buffer3[i];
if (value>0) ind_buffer1a[i]=value;
if (value<0) ind_buffer1b[i]=value;
}
//---- done
return(0);
}
//+------------------------------------------------------------------+
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #65 (permalink)  
Old 01-24-2006, 09:07 PM
kamyar's Avatar
Senior Member
 
Join Date: Dec 2005
Location: Iran
Posts: 635
kamyar is on a distinguished road
Hi

i have an indicatore which is able to recognize the butterfly pattern but it is written for MT3 can anybody do me a favor and convert it to MQL4.
Attached Files
File Type: mql butterfly.mql (2.1 KB, 50 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #66 (permalink)  
Old 01-24-2006, 09:12 PM
kamyar's Avatar
Senior Member
 
Join Date: Dec 2005
Location: Iran
Posts: 635
kamyar is on a distinguished road
i attachd two pdf.the gist of the pattern and the rules are mentioned
Attached Files
File Type: pdf attachment2.pdf (140.1 KB, 133 views)
File Type: pdf attachment1.pdf (189.0 KB, 110 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #67 (permalink)  
Old 01-30-2006, 04:26 AM
currencyshmuck's Avatar
Member
 
Join Date: Jan 2006
Posts: 44
currencyshmuck is on a distinguished road
hi

hello guys,
you all may know the name of this author but never knew that
his method coded into software.
Pesavento wroted among the others this wonderful books:
* Fibonacci Ratios with Pattern Recognition
* Profitable Patterns for Stock Trading
* Astro-Cycles : Traders Viewpoint
by the way i know that ENSIGN software also have his original Pesavento Patterns study tool wich can be seen in the next link.
if someone can import it from ENSIGN to MetaTrader 4 it will be amazing.
http://www.ensignsoftware.com/help/pesavento.htm
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #68 (permalink)  
Old 01-31-2006, 07:26 AM
currencyshmuck's Avatar
Member
 
Join Date: Jan 2006
Posts: 44
currencyshmuck is on a distinguished road
hi again

i found the code for the gartley 222 pattern on two platforms.
if anybody can translate it to MetaTrade 4 it will be superb!

here are the codes :

1.TradeStation code for Gartley 222 pattern found in "Trading the Gartley 222" by Aaron Behle and Mark Conway, p. 38:

Inputs:
Length(100),
Strength(8),
Tolerance(0.10),
BullColor(Blue),
BearColor(Red);

Variables:
F1(0.618),
F2(0.786),
F3(1.27),
F4(1.618),
P1Bar(-1),
P2Bar(-1),
T1Bar(-1),
T2Bar(-1),
P1(0.0),
P2(0.0),
T1(0.0),
T2(0.0),
PTValid(False),
HLValid(False),
InZone(False),
GD(0.0),
XA(0.0),
AB(0.0),
BC(0.0),
CD(0.0),
AD(0.0),
C1(False),
C2(False),
C3(False),
C4(False),
ABdXA(0.0),
BCdAB(0.0),
CDdBC(0.0),
ADdXA(0.0),
TL1(-1),
TL2(-1),
TL3(-1),
TL4(-1),
TL5(-1),
TL6(-1);

P1Bar = SwingHighBar(1, High, Strength, Length);
P2Bar = SwingHighBar(2, High, Strength, Length);
T1Bar = SwingLowBar(1, Low, Strength, Length);
T2Bar = SwingLowBar(2, Low, Strength, Length);
If P1Bar <> -1 and
P2Bar <> -1 and
T1Bar <> -1 and
T2Bar <> -1 Then Begin
{Test for a bullish 222}
{Trough X is T2}
T2 = Low[T2Bar];
{Peak A is P2}
P2 = High[P2Bar];
{Trough B is T1}
T1 = Low[T1Bar];
{Peak C is P1}
P1 = High[P1Bar];
{D is the buy point}
GD = Low;
PTValid = P1Bar < T1Bar and T1Bar < P2Bar and P2Bar < T2Bar;
HLValid = P1 < P2 and T1 > T2 and P1 > T1;
InZone = GD < T1 and GD > T2 and P2 >= Highest(High, T2Bar);
If PTValid and HLValid and InZone Then Begin
XA = P2 - T2;
AB = P2 - T1;
BC = P1 - T1;
CD = P1 - GD;
AD = P2 - GD;
ABdXA = AB / XA; {AB should be 61.8% of XA}
C1 = ABdXA > F1 - Tolerance and ABdXA < F1 + Tolerance;
BCdAB = BC / AB; {BC should be 61.8-78.6% of AB}
C2 = BCdAB > F1 - Tolerance and BCdAB < F2 + Tolerance;
CDdBC = CD / BC; {CD should be 127-161.8% of BC}
C3 = CDdBC > F3 - Tolerance and CDdBC < F4 + Tolerance;
ADdXA = AD / XA; {AD should be 78.6% of XA}
C4 = ADdXA > F2 - Tolerance and ADdXA < F2 + Tolerance;
If C1 and C2 and C3 and C4 Then Begin
TL1 = TL_New(Date[T2Bar], Time[T2Bar], T2, Date[P2Bar], Time[P2Bar], P2);
If TL1 >= 0 Then Begin
TL_SetColor(TL1, BullColor);
TL_SetStyle(TL1, Tool_Solid);
TL_SetSize(TL1, 2);
End;
TL2 = TL_New(Date[P2Bar], Time[P2Bar], P2, Date[T1Bar], Time[T1Bar], T1);
If TL2 >= 0 Then Begin
TL_SetColor(TL2, BullColor);
TL_SetStyle(TL2, Tool_Solid);
TL_SetSize(TL2, 2);
End;
TL3 = TL_New(Date[T1Bar], Time[T1Bar], T1, Date[P1Bar], Time[P1Bar], P1);
If TL3 >= 0 Then Begin
TL_SetColor(TL3, BullColor);
TL_SetStyle(TL3, Tool_Solid);
TL_SetSize(TL3, 2);
End;
TL4 = TL_New(Date[P1Bar], Time[P1Bar], P1, Date, Time, GD);
If TL4 >= 0 Then Begin
TL_SetColor(TL4, BullColor);
TL_SetStyle(TL4, Tool_Solid);
TL_SetSize(TL4, 2);
End;
TL5 = TL_New(Date[T1Bar], Time[T1Bar], T1, Date, Time, GD);
If TL5 >= 0 Then Begin
TL_SetColor(TL5, BullColor);
TL_SetStyle(TL5, Tool_Dotted);
End;
TL6 = TL_New(Date[T2Bar], Time[T2Bar], T2, Date, Time, GD);
If TL6 >= 0 Then Begin
TL_SetColor(TL6, BullColor);
TL_SetStyle(TL6, Tool_Dotted);
End;
End;
End;
{Test for a bearish 222}
{Peak X is P2}
{Trough A is T2}
{Peak B is P1}
{Trough C is T1}
{GD is the short point}
GD = High;
PTValid = T1Bar < P1Bar and P1Bar < T2Bar and T2Bar < P2Bar;
HLValid = T1 > T2 and P1 < P2 and T1 < P1;
InZone = GD > P1 and GD < P2 and T2 <= Lowest(Low, P2Bar);
If PTValid and HLValid and InZone Then Begin
XA = P2 - T2;
AB = P1 - T2;
BC = P1 - T1;
CD = GD - T1;
AD = GD - T2;
ABdXA = AB / XA; {AB should be 61.8% of XA}
C1 = ABdXA > F1 - Tolerance and ABdXA < F1 + Tolerance;
BCdAB = BC / AB; {BC should be 61.8-78.6% of AB}
C2 = BCdAB > F1 - Tolerance and BCdAB < F2 + Tolerance;
CDdBC = CD / BC; {CD should be 127-161.8% of BC}
C3 = CDdBC > F3 - Tolerance and CDdBC < F4 + Tolerance;
ADdXA = AD / XA; {AD should be 78.6% of XA}
C4 = ADdXA > F2 - Tolerance and ADdXA < F2 + Tolerance;
If C1 and C2 and C3 and C4 Then Begin
TL1 = TL_New(Date[P2Bar], Time[P2Bar], P2, Date[T2Bar], Time[T2Bar], T2);
If TL1 >= 0 Then Begin
TL_SetColor(TL1, BearColor);
TL_SetStyle(TL1, Tool_Solid);
TL_SetSize(TL1, 2);
End;
TL2 = TL_New(Date[T2Bar], Time[T2Bar], T2, Date[P1Bar], Time[P1Bar], P1);
If TL2 >= 0 Then Begin
TL_SetColor(TL2, BearColor);
TL_SetStyle(TL2, Tool_Solid);
TL_SetSize(TL2, 2);
End;
TL3 = TL_New(Date[P1Bar], Time[P1Bar], P1, Date[T1Bar], Time[T1Bar], T1);
If TL3 >= 0 Then Begin
TL_SetColor(TL3, BearColor);
TL_SetStyle(TL3, Tool_Solid);
TL_SetSize(TL3, 2);
End;
TL4 = TL_New(Date[T1Bar], Time[T1Bar], T1, Date, Time, GD);
If TL4 >= 0 Then Begin
TL_SetColor(TL4, BearColor);
TL_SetStyle(TL4, Tool_Solid);
TL_SetSize(TL4, 2);
End;
TL5 = TL_New(Date[P1Bar], Time[P1Bar], P1, Date, Time, GD);
If TL5 >= 0 Then Begin
TL_SetColor(TL5, BearColor);
TL_SetStyle(TL5, Tool_Dotted);
End;
TL6 = TL_New(Date[P2Bar], Time[P2Bar], P2, Date, Time, GD);
If TL6 >= 0 Then Begin
TL_SetColor(TL6, BearColor);
TL_SetStyle(TL6, Tool_Dotted);
End;
End;
End;
End;

2.Wealth-Lab code:

procedure Gartley222
(
VPFactor: float;
Tolerance: float;
Lookback: integer;
HoldBars: integer;
VolMin: integer
);
begin
var ATRValue, VP, Reversal: float;
var F1, F2, F3, F4, P1, P2, T1, T2: float;
var Bar, P1Bar, P2Bar, T1Bar, T2Bar, p: integer;
var XA, AB, BC, CD, AD, D, XD, DT, ABdXA, BCdAB, CDdBC, ADdXA: float;
var PTValid, HLValid, InZone, C1, C2, C3, C4: boolean;
var BT, BS, ST, SS: float;

{Fibonacci Constants}
F1 := 0.618;
F2 := 0.786;
F3 := 1.27;
F4 := 1.618;

InstallTimeBasedExit(HoldBars);
for Bar := Lookback to BarCount() - 1 do
begin
ApplyAutoStops(Bar);
ATRValue := ATR(Bar, Lookback);
SetShareSize( 1000 * Int( 10 / ATRValue ) );
VP := 100 * ATRValue / PriceClose(Bar);
{Find peaks and troughs}
Reversal := Int(VPFactor * VP);
P1 := Peak(Bar, #High, F1 * Reversal);
P1Bar := PeakBar(Bar, #High, F1 * Reversal);
P2 := Peak(P1Bar, #High, Reversal);
P2Bar := PeakBar(P1Bar, #High, Reversal);
T1 := Trough(Bar, #Low, F1 * Reversal);
T1Bar := TroughBar(Bar, #Low, F1 * Reversal);
T2 := Trough(T1Bar, #Low, Reversal);
T2Bar := TroughBar(T1Bar, #Low, Reversal);
{Test for a bullish 222}
{Trough X is T2}
{Peak A is P2}
{Trough B is T1}
{Peak C is P1}
{D is the buy zone}
D := PriceLow(Bar);
PTValid := (P1Bar > T1Bar) and (T1Bar > P2Bar) and (P2Bar > T2Bar);
HLValid := (P1 < P2) and (T1 > T2) and (P1 > T1);
InZone := (D < T1) and (D > T2);
if (MarketPosition = 0) and
(SMA(Bar, #Volume, Lookback) >= VolMin) and
(PTValid) and (HLValid) and (InZone) then
begin
XA := P2 - T2;
AB := P2 - T1;
BC := P1 - T1;
XD := P2 - (F2 * XA);
CD := P1 - XD;
AD := P2 - XD;
ABdXA := AB / XA; {AB should be 61.8% of XA}
C1 := (ABdXA > F1 - Tolerance) and (ABdXA < F1 + Tolerance);
BCdAB := BC / AB; {BC should be 61.8-78.6% of AB}
C2 := (BCdAB > F1 - Tolerance) and (BCdAB < F2 + Tolerance);
CDdBC := CD / BC; {CD should be 127-161.8% of BC}
C3 := (CDdBC > F3 - Tolerance) and (CDdBC < F4 + Tolerance);
ADdXA := AD / XA; {AD should be 78.6% of XA}
C4 := (ADdXA > F2 - Tolerance) and (ADdXA < F2 + Tolerance);
if C1 and C2 and C3 and C4 then
begin
DrawLine(P2Bar, P2, T2Bar, T2, 0, #Blue, #Solid);
DrawLine(T1Bar, T1, P2Bar, P2, 0, #Blue, #Solid);
DrawLine(P1Bar, P1, T1Bar, T1, 0, #Blue, #Solid);
DrawLine(Bar, D, P1Bar, P1, 0, #Blue, #Solid);
DrawLine(Bar, D, T1Bar, T1, 0, #Blue, #Dotted);
DrawLine(Bar, D, T2Bar, T2, 0, #Blue, #Dotted);
AnnotateBar('B', Bar, True, #Blue, 10);
BuyAtLimit(Bar, XD, 'G222 LE');
DT := F1 * CD;
BT := XD + DT;
BS := T2;
end;
end;
{Test for a bearish 222}
{Peak X is P2}
{Trough A is T2}
{Peak B is P1}
{Trough C is T1}
{D is the short zone}
D := PriceHigh(Bar);
PTValid := (T1Bar > P1Bar) and (P1Bar > T2Bar) and (T2Bar > P2Bar);
HLValid := (T1 > T2) and (P1 < P2) and (T1 < P1);
InZone := (D > P1) and (D < P2);
if (MarketPosition = 0) and
(PriceClose( Bar ) >= 5) and
(SMA(Bar, #Volume, Lookback) >= VolMin) and
(PTValid) and (HLValid) and (InZone) then
begin
XA := P2 - T2;
AB := P1 - T2;
BC := P1 - T1;
XD := T2 + (F2 * XA);
CD := XD - T1;
AD := XD - T2;
ABdXA := AB / XA; {AB should be 61.8% of XA}
C1 := (ABdXA > F1 - Tolerance) and (ABdXA < F1 + Tolerance);
BCdAB := BC / AB; {BC should be 61.8-78.6% of AB}
C2 := (BCdAB > F1 - Tolerance) and (BCdAB < F2 + Tolerance);
CDdBC := CD / BC; {CD should be 127-161.8% of BC}
C3 := (CDdBC > F3 - Tolerance) and (CDdBC < F4 + Tolerance);
ADdXA := AD / XA; {AD should be 78.6% of XA}
C4 := (ADdXA > F2 - Tolerance) and (ADdXA < F2 + Tolerance);
if C1 and C2 and C3 and C4 then
begin
DrawLine(T2Bar, T2, P2Bar, P2, 0, #Red, #Solid);
DrawLine(P1Bar, P1, T2Bar, T2, 0, #Red, #Solid);
DrawLine(T1Bar, T1, P1Bar, P1, 0, #Red, #Solid);
DrawLine(Bar, D, T1Bar, T1, 0, #Red, #Solid);
DrawLine(Bar, D, P1Bar, P1, 0, #Red, #Dotted);
DrawLine(Bar, D, P2Bar, P2, 0, #Red, #Dotted);
AnnotateBar('S', Bar, False, #Red, 10);
ShortAtLimit(Bar, XD, 'G222 SE');
DT := F1 * CD;
ST := XD - DT;
SS := P2;
end;
end;
if LastPositionActive then
begin
if MarketPosition = 1 then begin
SellAtLimit(Bar+1, BT, #All, 'G222 LX+');
SellAtStop(Bar+1, BS, #All, 'G222 LX-');
end;
if MarketPosition = -1 then begin
CoverAtLimit(Bar+1, ST, #All, 'G222 LX+');
CoverAtStop(Bar+1, SS, #All, 'G222 LX-');
end;
end;
end;
end;

Gartley222(2.0, 0.1, 20, 7, 2000000);
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #69 (permalink)  
Old 01-31-2006, 08:20 PM
Junior Member
 
Join Date: Jan 2006
Posts: 1
Zero_forex is on a distinguished road
Post What is SMCMA and WCMA ???

Anybody Knows anything about these 2 things MA and where to get and use them for Meta Trader 4

1. SMCMA
2. WCMA



The only thing I able to know that these are some Type of MA
(Moving Averages) but where to get them and how to use them ??

bye
Zero_Forex
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #70 (permalink)  
Old 02-01-2006, 03:10 AM
Willis11of12's Avatar
Senior Member
 
Join Date: Dec 2005
Posts: 105
Willis11of12 is on a distinguished road
Using other currency pairs in an EA?

Does anyone know how to make an Expert Advisor check other currency pair charts to help decide if you want to do a buy or sell? For example, how could I make an EA look at the usd-chf as part of criteria to decide whether to buy or sell on the gbp-chf? I have an EA that I like so far, but I think it could be better if I could also have it written into the program to check other related pairs. Codersguru, or anyone else that can help, please let me know.
Thanks!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks

Tags
histogram

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 On
Forum Jump

LinkBacks (?)
LinkBack to this Thread: http://www.forex-tsd.com/questions/270-ask.html
Posted By For Type Date
OzFx System:) - Page 639 This thread Refback 06-21-2008 09:53 PM
Forex SRDC Sidus Sibkis EA MT4 Forum OTCSmart This thread Refback 12-08-2007 11:46 AM


All times are GMT. The time now is 10:46 PM.



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