Sharesmagazine
 Home   Log In   Register   Our Services   My Account   Contact   Help 
 Stockwatch   Level 2   Portfolio   Charts   Share Price   Awards   Market Scan   Videos   Broker Notes   Director Deals   Traders' Room 
 Funds   Trades   Terminal   Alerts   Heatmaps   News   Indices   Forward Diary   Forex Prices   Shares Magazine   Investors' Room 
 CFDs   Shares   SIPPs   ISAs   Forex   ETFs   Comparison Tables   Spread Betting 
You are NOT currently logged in
 
Register now or login to post to this thread.

The Forex Thread (FX)     

hilary - 31 Dec 2003 13:00

Your browser does not support JavaScript! Your browser does not support JavaScript!
Your browser does not support inline frames or is currently configured not to display inline frames.
Forex rebates on every trade - win or lose!

Seymour Clearly - 21 May 2008 17:17 - 9830 of 11056

Jeef, I've also been playing with Euro Yen recently, more to the long side! - just the way it was when I look in.

Agree 163 looks like a tough nut - may try & post a chart later for people's thoughts.

FreemanFox - 21 May 2008 19:16 - 9831 of 11056

I've been in and out on E/J over the past week too, always from the short side. I was expecting a big move down, though the recent strength may force me re-evaluate tomorrow it it doesn't happen. I've recently re-shorted from 162.95.

goforit - 22 May 2008 14:05 - 9832 of 11056

eur/jpy just broken 163!

jeffmack - 22 May 2008 15:07 - 9833 of 11056

And some

Seymour Clearly - 22 May 2008 16:35 - 9834 of 11056

Pah, missed it - and I felt it in my bones it was going to go. Not having a good day here - was long Fiber instead of cable this morning - bad decision no. 1, then missed the boat on E/J :-(

Work doesn't half get in the way of trading....

goforit - 22 May 2008 16:50 - 9835 of 11056

taken a profit, doesnt look very convincing to me, seeing abit of divergence on indicators........probably take of now!

chocolat - 30 May 2008 23:42 - 9836 of 11056

NEW YORK (Dow Jones)--The dollar declined Friday against the euro and yen, tipped off by a U.S. report that showed consumer sentiment at a 28-year low.

But the greenback still retained most of its gains from earlier in the week, and currency strategists said the decline represented some end-of-week consolidation after three days of sold gains.

Overnight, the euro fell to a two-week low of $1.5461 after reports that showed disappointing German retail sales and accelerated euro-zone consumer price inflation, leading to concern over a stagflation scenario in Europe.

But the single currency bounced back to an intraday high during the New York session of $1.5570 - though still below this week's peak of $1.5819.

Friday afternoon in New York, the euro was at $1.5557 from $1.5507 late Thursday, while the dollar was at Y105.42 from Y105.58. The euro was at Y163.98 from Y163.72 late Thursday, according to EBS. The U.K. pound was at $1.9803 from $1.9767, while the dollar was at CHF1.0421 from CHF1.0496 late Thursday.

The Reuters/University of Michigan final consumer sentiment survey for May saw the overall index declined for the fourth straight month, to 59.8 from 62.6 in April.

However, the November fed-funds futures contract still showed about a 58% chance for the Federal Open Market Committee to hike its key rate at the Oct. 28-29 meeting, compared with a 72% chance Thursday.

Growing inflation concerns, spurred on by the elevated price of oil and food, as well as recent speeches by Fed members, have turned the market's attention from growth concerns and potential rate cuts to rate hikes.

That outlook is sustaining the dollar's stronger sentiment.

A string of Federal Reserve rate cuts that began last year has been a major factor in the dollar's underperformance against its rivals since last September. Lower rates tend to reduce returns on dollar-based investments, leading traders to sell the dollar and buy currencies that offer higher yields.

The release Friday of the Commerce Department's personal consumption expenditures price index, excluding food and energy, reinforced the new dominating market view. The core inflation measure climbed 2.1% in April year-over-year, above the Fed's presumed comfort level of 2.0%.

The dollar was also lent support Friday by crude oil prices, which continued to stay under the $130-a-barrel mark. Cheaper oil is seen as helpful to the recovery of the U.S. economy.

"To a large extent, the G7 appear to have gotten what they wanted," said Marc Chandler, global head of foreign exchange at Brown Brothers Harriman & Co. in New York. At the last meeting of the Group of Seven leading industrialized nations, leaders expressed concern about the fluctuations in the foreign exchange market, as the euro broke record highs against the dollar.

"A better two-way market for the dollar has emerged and the implied volatility for the dollar against the euro and yen has fallen," said Chandler.

Next week, currency traders will pay close attention to the European Central Bank's interest rate decision Thursday and the release Friday of the U.S. monthly nonfarm payrolls report for May.

hilary - 02 Jun 2008 10:47 - 9837 of 11056

I could do with a little bit of help here. I've cobbled together a custom indicator for MT4 which will draw up and down arrows on the chart when you get a ma crossover of the macd.

Although it will draw the arrows historically, it doesn't seem to draw them real time. I wonder if Foxey (or someone else) could perhaps take a look at it and please tell me why.

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Aqua
#property indicator_width1 3
#property indicator_color2 Magenta
#property indicator_width2 3


extern int MACD_Fast = 12;
extern int MACD_Slow = 26;
extern int MACD_Slowing = 9;
extern int Shift_Bars=0;
extern int Bars_Count= 20000;



//---- buffers
double v1[];
double v2[];


int init()
{

IndicatorBuffers(2);
SetIndexArrow(0,233);
SetIndexStyle(0,DRAW_ARROW);
SetIndexDrawBegin(0,-1);
SetIndexBuffer(0, v1);
SetIndexLabel(0,"Buy");

SetIndexArrow(1,234);
SetIndexStyle(1,DRAW_ARROW);
SetIndexDrawBegin(1,-1);
SetIndexBuffer(1, v2);
SetIndexLabel(1,"Sell");





return(0);
}

int start()
{
double macd, macd_sig;
int previous;
int i;
int shift;
bool crossed_up, crossed_down;
int counted_bars = IndicatorCounted();
if (counted_bars > 0) counted_bars--;
if (Bars_Count > 0 && Bars_Count < = Bars)
{
i = Bars_Count - counted_bars;
}else{
i = Bars - counted_bars;
}

while(i>=0)
{
shift = i + Shift_Bars;

macd = iMACD(Symbol(), Period(), MACD_Fast, MACD_Slow, MACD_Slowing, PRICE_CLOSE, MODE_MAIN, shift+1);
macd_sig = iMACD(Symbol(), Period(), MACD_Fast, MACD_Slow, MACD_Slowing, PRICE_CLOSE, MODE_SIGNAL, shift+1);
crossed_up = (macd > macd_sig);
crossed_down = (macd < macd_sig);


if (crossed_up && previous != 1) {
v1[i] = Open[shift];
previous = 1;
}else if(crossed_down && previous != 2){
v2[i] = Open[shift];
previous = 2;
}

i--;
}
return(0);
}

//+------------------------------------------------------------------+

MightyMicro - 02 Jun 2008 11:33 - 9838 of 11056

Bloody hell! Hil the Hacker!

Seymour Clearly - 02 Jun 2008 11:44 - 9839 of 11056

Can't help with that Hil, but sent you a mail last night re another aspect of MT4. Just in case it got junked!

FreemanFox - 02 Jun 2008 11:46 - 9840 of 11056

Hi Hils,

Just had a quick look at your code as not really much time at moment.

Your problem is to do with setting your value for i. After the first loop it will always be negative so cause your code to never execute again.

It is a one line correction, set i=Bars_Count as shown below.

if (Bars_Count > 0 && Bars_Count <= Bars)
{
i = Bars_Count;
}else{
i = Bars - counted_bars;
}

There are more efficient ways to do it as you are always recalculating the history when not needed but this will sort it out for now.

hilary - 02 Jun 2008 11:56 - 9841 of 11056

That's great, thanks Foxey. I couldn't see that error for looking until you pointed it out. The code has actually been cobbled together from another custom indicator, so I can't take the credit for it being all my own work. Presumably that other indicator doesn't draw real time either.

:o)

Seymour,

Yes, got your email, thanks. I have got Alpari and ODL installed together on one machine for those Condor Moments when ODL go down. I've not tried it yet, but I'll give it a go when I've got a mo.

Seymour Clearly - 02 Jun 2008 12:38 - 9842 of 11056

OK Hil - not sure if it's worth the effort when all you need is just copies of the same files in the corresponding directories - but would make sure they were always the same.

hilary - 04 Jun 2008 09:55 - 9843 of 11056

I need a bit more help now please folks.

After Foxey kindly showed me the error of my ways with my ma crossover of MACD the other day, I went back to the drawing board and re-wrote it completely using some code from another indicator called 2MA crossover which also gives an option to change arrow styles and has some nice "Avon Calling" ding dong alerts.

I now want to code it for MTF (iCustom will be fine). Unfortunately I've given it a go myself and keep getting some compilation errors that I don't understand.

Here's my code for the basic indicator.

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 DodgerBlue
#property indicator_width1 3
#property indicator_color2 Magenta
#property indicator_width2 3

extern int MACD_Fast = 12;
extern int MACD_Slow = 26;
extern int MACD_Slowing = 9;
extern int Bars_Count= 20000;

extern string note1 = "Arrow Type";
extern string note2 = "0=Thick, 1=Thin, 2=Hollow, 3=Round";
extern string note3 = "4=Fractal, 5=Diagonal Thin";
extern string note4 = "6=Diagonal Thick, 7=Diagonal Hollow";
extern string note5 = "8=Thumb, 9=Finger";
extern int ArrowType=2;
extern string note6 = "--------------------------------------------";
extern string note7 = "turn on Alert = true; turn off = false";
extern bool AlertOn = true;
extern string note8 = "--------------------------------------------";
extern string note9 = "send Email Alert = true; turn off = false";
extern bool SendAnEmail=false;

double CrossUp[];
double CrossDown[];
string AlertPrefix;
string GetTimeFrameStr() {
switch(Period())
{
case 1 : string TimeFrameStr="M1"; break;
case 5 : TimeFrameStr="M5"; break;
case 15 : TimeFrameStr="M15"; break;
case 30 : TimeFrameStr="M30"; break;
case 60 : TimeFrameStr="H1"; break;
case 240 : TimeFrameStr="H4"; break;
case 1440 : TimeFrameStr="D1"; break;
case 10080 : TimeFrameStr="W1"; break;
case 43200 : TimeFrameStr="MN1"; break;
default : TimeFrameStr=Period();
}
return (TimeFrameStr);
}

//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
if (ArrowType == 0) {
SetIndexStyle(0,DRAW_ARROW);
SetIndexArrow(0, 233);
SetIndexStyle(1,DRAW_ARROW);
SetIndexArrow(1, 234);
}
else if (ArrowType == 1) {
SetIndexStyle(0,DRAW_ARROW);
SetIndexArrow(0, 225);
SetIndexStyle(1,DRAW_ARROW);
SetIndexArrow(1, 226);
}
else if (ArrowType == 2) {
SetIndexStyle(0,DRAW_ARROW);
SetIndexArrow(0, 241);
SetIndexStyle(1,DRAW_ARROW);
SetIndexArrow(1, 242);
}
else if (ArrowType == 3) {
SetIndexStyle(0,DRAW_ARROW);
SetIndexArrow(0, 221);
SetIndexStyle(1,DRAW_ARROW);
SetIndexArrow(1, 222);
}
else if (ArrowType == 4) {
SetIndexStyle(0,DRAW_ARROW);
SetIndexArrow(0, 217);
SetIndexStyle(1,DRAW_ARROW);
SetIndexArrow(1, 218);
}
else if (ArrowType == 5) {
SetIndexStyle(0,DRAW_ARROW);
SetIndexArrow(0, 228);
SetIndexStyle(1,DRAW_ARROW);
SetIndexArrow(1, 230);
}
else if (ArrowType == 6) {
SetIndexStyle(0,DRAW_ARROW);
SetIndexArrow(0, 236);
SetIndexStyle(1,DRAW_ARROW);
SetIndexArrow(1, 238);
}
else if (ArrowType == 7) {
SetIndexStyle(0,DRAW_ARROW);
SetIndexArrow(0, 246);
SetIndexStyle(1,DRAW_ARROW);
SetIndexArrow(1, 248);
}
else if (ArrowType == 8) {
SetIndexStyle(0,DRAW_ARROW);
SetIndexArrow(0, 67);
SetIndexStyle(1,DRAW_ARROW);
SetIndexArrow(1, 68);
}
else if (ArrowType == 9) {
SetIndexStyle(0,DRAW_ARROW);
SetIndexArrow(0, 71);
SetIndexStyle(1,DRAW_ARROW);
SetIndexArrow(1, 72);
}

SetIndexBuffer(0, CrossUp);
SetIndexBuffer(1, CrossDown);


AlertPrefix=Symbol()+" ("+GetTimeFrameStr()+"): ";
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----

//----
return(0);
}
//+------------------------------------------------------------------+
bool NewBar()
{
static datetime lastbar;
datetime curbar = Time[0];
if(lastbar!=curbar)
{
lastbar=curbar;
return (true);
}
else
{
return(false);
}
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start() {
int limit, i, counter;

double macdnow, macd_signow, macdprevious, macd_sigprevious, macdafter, macd_sigafter;
double Range, AvgRange;
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;

for(i = 0; i < = limit; i++) {

counter=i;
Range=0;
AvgRange=0;
for (counter=i ;counter<=i+9;counter++)
{
AvgRange=AvgRange+MathAbs(High[counter]-Low[counter]);
}
Range=AvgRange/10;

macdnow = iMACD(Symbol(), Period(), MACD_Fast, MACD_Slow, MACD_Slowing, PRICE_CLOSE, MODE_MAIN, i);
macdprevious = iMACD(Symbol(), Period(), MACD_Fast, MACD_Slow, MACD_Slowing, PRICE_CLOSE, MODE_MAIN, i+1);
macdafter = iMACD(Symbol(), Period(), MACD_Fast, MACD_Slow, MACD_Slowing, PRICE_CLOSE, MODE_MAIN, i-1);


macd_signow = iMACD(Symbol(), Period(), MACD_Fast, MACD_Slow, MACD_Slowing, PRICE_CLOSE, MODE_SIGNAL, i);
macd_sigprevious = iMACD(Symbol(), Period(), MACD_Fast, MACD_Slow, MACD_Slowing, PRICE_CLOSE, MODE_SIGNAL, i+1);
macd_sigafter = iMACD(Symbol(), Period(), MACD_Fast, MACD_Slow, MACD_Slowing, PRICE_CLOSE, MODE_SIGNAL, i-1);


if ((macdnow > macd_signow) && (macdprevious < macd_sigprevious) && (macdafter > macd_sigafter)) {
CrossUp[i] = Low[i] - Range*1.5;
if (AlertOn && NewBar()) {
Alert(AlertPrefix + "MACD ("+MACD_Fast+","+MACD_Slow+","+MACD_Slowing+") crosses UP");
}
if (SendAnEmail && NewBar()) {
SendMail(AlertPrefix, "MACD ("+MACD_Fast+","+MACD_Slow+","+MACD_Slowing+") crosses UP");
}
}
else if ((macdnow < macd_signow) && (macdprevious > macd_sigprevious) && (macdafter < macd_sigafter)) {
CrossDown[i] = High[i] + Range*1.5;
if (AlertOn && NewBar()) {
Alert(AlertPrefix + "MACD ("+MACD_Fast+","+MACD_Slow+","+MACD_Slowing+") crosses DOWN");
}
if (SendAnEmail && NewBar()) {
SendMail(AlertPrefix, "MACD ("+MACD_Fast+","+MACD_Slow+","+MACD_Slowing+") crosses DOWN");
}
}
}
return(0);
}

Kayak - 04 Jun 2008 10:05 - 9844 of 11056

Your son did all that, didn't he :-)

hilary - 04 Jun 2008 10:07 - 9845 of 11056

I cook him dinner each night!

:o)

qwento - 04 Jun 2008 10:53 - 9846 of 11056

Hilary.

for(i = 0; i < = limit; i++) {

You have a space between the '<' and the '=', remove it and it compiles

hilary - 04 Jun 2008 11:17 - 9847 of 11056

Qwento,

Thanks for that, although I'm not sure where that space has come from. It's not there in my mq4 file which does compile OK.

To re-iterate, it's a MTF version of the above that I'm trying to code. I've named the above mq4 file MACD Crossover Arrows & Alert and tried to create a MTF file using iCustom. Here's my MTF code:

//+------------------------------------------------------------------+
//| MTF MACD Crossover Arrows & Alert |
//+------------------------------------------------------------------+

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 DodgerBlue
#property indicator_width1 3
#property indicator_color2 Magenta
#property indicator_width2 3



extern string note1 = "Arrow Type";
extern string note2 = "0=Thick, 1=Thin, 2=Hollow, 3=Round";
extern string note3 = "4=Fractal, 5=Diagonal Thin";
extern string note4 = "6=Diagonal Thick, 7=Diagonal Hollow";
extern string note5 = "8=Thumb, 9=Finger";
extern int ArrowType=2;
extern string note6 = "--------------------------------------------";
extern string note7 = "turn on Alert = true; turn off = false";
extern bool AlertOn = true;
extern string note8 = "--------------------------------------------";
extern string note9 = "send Email Alert = true; turn off = false";
extern bool SendAnEmail=false;


string AlertPrefix;
string GetTimeFrameStr() {

}
//---- input parameters
/*************************************************************************
PERIOD_M1 1
PERIOD_M5 5
PERIOD_M15 15
PERIOD_M30 30
PERIOD_H1 60
PERIOD_H4 240
PERIOD_D1 1440
PERIOD_W1 10080
PERIOD_MN1 43200
You must use the numeric value of the timeframe that you want to use
when you set the TimeFrame' value with the indicator inputs.
---------------------------------------*/

extern int TimeFrame=0;

//---- input parameters
extern int MACD_Fast = 12;
extern int MACD_Slow = 26;
extern int MACD_Slowing = 9;
extern int Bars_Count= 20000;

//---- buffers
double CrossUp[];
double CrossDown[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+

int init()
{
//---- indicators
if (ArrowType == 0) {
SetIndexStyle(0,DRAW_ARROW);
SetIndexArrow(0, 233);
SetIndexStyle(1,DRAW_ARROW);
SetIndexArrow(1, 234);
}
else if (ArrowType == 1) {
SetIndexStyle(0,DRAW_ARROW);
SetIndexArrow(0, 225);
SetIndexStyle(1,DRAW_ARROW);
SetIndexArrow(1, 226);
}
else if (ArrowType == 2) {
SetIndexStyle(0,DRAW_ARROW);
SetIndexArrow(0, 241);
SetIndexStyle(1,DRAW_ARROW);
SetIndexArrow(1, 242);
}
else if (ArrowType == 3) {
SetIndexStyle(0,DRAW_ARROW);
SetIndexArrow(0, 221);
SetIndexStyle(1,DRAW_ARROW);
SetIndexArrow(1, 222);
}
else if (ArrowType == 4) {
SetIndexStyle(0,DRAW_ARROW);
SetIndexArrow(0, 217);
SetIndexStyle(1,DRAW_ARROW);
SetIndexArrow(1, 218);
}
else if (ArrowType == 5) {
SetIndexStyle(0,DRAW_ARROW);
SetIndexArrow(0, 228);
SetIndexStyle(1,DRAW_ARROW);
SetIndexArrow(1, 230);
}
else if (ArrowType == 6) {
SetIndexStyle(0,DRAW_ARROW);
SetIndexArrow(0, 236);
SetIndexStyle(1,DRAW_ARROW);
SetIndexArrow(1, 238);
}
else if (ArrowType == 7) {
SetIndexStyle(0,DRAW_ARROW);
SetIndexArrow(0, 246);
SetIndexStyle(1,DRAW_ARROW);
SetIndexArrow(1, 248);
}
else if (ArrowType == 8) {
SetIndexStyle(0,DRAW_ARROW);
SetIndexArrow(0, 67);
SetIndexStyle(1,DRAW_ARROW);
SetIndexArrow(1, 68);
}
else if (ArrowType == 9) {
SetIndexStyle(0,DRAW_ARROW);
SetIndexArrow(0, 71);
SetIndexStyle(1,DRAW_ARROW);
SetIndexArrow(1, 72);
}

SetIndexBuffer(0, CrossUp);
SetIndexBuffer(1, CrossDown);


AlertPrefix=Symbol()+" ("+GetTimeFrameStr()+"): ";

//---- name for DataWindow and indicator subwindow label

switch(TimeFrame)
{
case 1 : string TimeFrameStr="Period M1"; break;
case 5 : TimeFrameStr="Period M5"; break;
case 15 : TimeFrameStr="Period M15"; break;
case 30 : TimeFrameStr="Period M30"; break;
case 60 : TimeFrameStr="Period H1"; break;
case 240 : TimeFrameStr="Period H4"; break;
case 1440 : TimeFrameStr="Period D1"; break;
case 10080 : TimeFrameStr="Period W1"; break;
case 43200 : TimeFrameStr="Period MN1"; break;
default : TimeFrameStr="Current Timeframe";
}


//----

return(0);


//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----

//----
return(0);
}
//+------------------------------------------------------------------+
bool NewBar()
{
static datetime lastbar;
datetime curbar = Time[0];
if(lastbar!=curbar)
{
lastbar=curbar;
return (true);
}
else
{
return(false);
}
}

//+------------------------------------------------------------------+
//| MTF MACD Crossover |
//+------------------------------------------------------------------+

int start()
{

datetime TimeArray[];
int i,limit,y=0,counted_bars=IndicatorCounted();

// Plot defined time frame on to current time frame

ArrayCopySeries(TimeArray,MODE_TIME,Symbol(),TimeFrame);

limit= Bars-counted_bars;
for(i=0,y=0;i

I get a compilation error for line 158 which I don't understand. I also suspect that the main indicator loop is probably wrong.

FreemanFox - 04 Jun 2008 19:41 - 9848 of 11056

Hils,

Just looked and see your coding request.

You've got two blocks of code here which are different. The 2nd post has blocks of crucial code commented out (incorrectly) which make it not compile. The first complies easily by doing the change which Qwento suggested.

Glancing at the code, is the second example suppose to be a modification of the first as I'm not quiet sure what the relationship is between the two and what your trying to do otherwise? Why 2 blocks of code?

hilary - 05 Jun 2008 07:01 - 9849 of 11056

Foxey,

The first block of code in post 9843 is an indicator which I (with the help of my son) have created. It draws up or down arrows on the chart with a ma crossover of the MACD. It compiles and works well without any problem.

I'm not sure where the space between the "less than" and"equals" sign that Qwento identified has come from as it certainly wasn't there in MetaEditor. I suspect it simply appeared from Cyberspace when I copied and pasted from MetaEditor into the am post. This would make sense as there are also a couple of things which have displayed differently in the post to the way they appear in MetaEditor.

As I say though, this indicator is not a problem and works fine.

My problem is that I am trying to produce a MTF version of the indicator and that's where I (and my son) are struggling and asked for some assistance. The best we've come up with so far is the block of code in post 9847. The basic indicator has been called MACD Crossover Arrows & Alert and we are trying to link the MTF version to it via iCustom. At the moment we get a compilation error that we don't understand in Line 158. We also suspect that the indicator loop may be wrong.

A little knowledge is clearly a dangerous thing. My approach to this coding malarky has been to look at existing code, try to understand what it's doing and then to replicate it for my own purposes. I still have a long way to go before I'll be able to swap my Manolos for a pair of Jesus sandals and pretend to be a real coder.

Cue DelBoy.

:o)
Register now or login to post to this thread.