Ask! - page 15

 
Aaragorn:
I want to learn how to use this tool. http://sufx.core.t3-ism.net/ExpertAdvisorBuilder/

I made a EA and compiled it and got these 6 errors...

'.' - initialization expected C:\Program Files\Interbank FX Trader 4\experts\macdstochma5m.mq4 (16, 22)

'1' - comma or semicolon expected C:\Program Files\Interbank FX Trader 4\experts\macdstochma5m.mq4 (16, 23)

'Lots' - variable not defined C:\Program Files\Interbank FX Trader 4\experts\macdstochma5m.mq4 (179, 44)

'Lots' - variable not defined C:\Program Files\Interbank FX Trader 4\experts\macdstochma5m.mq4 (187, 47)

'Lots' - variable not defined C:\Program Files\Interbank FX Trader 4\experts\macdstochma5m.mq4 (206, 44)

'Lots' - variable not defined C:\Program Files\Interbank FX Trader 4\experts\macdstochma5m.mq4 (214, 48)

would someone assist me in correcting these errors, I just learned how to compile but I don't know how to code.

here is the code ...

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

//| This MQL is generated by Expert Advisor Builder |

//| http://sufx.core.t3-ism.net/ExpertAdvisorBuilder/ |

//| |

//| In no event will author be liable for any damages whatsoever. |

//| Use at your own risk. |

//| |

//| Please do not remove this header. |

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

#property copyright "Expert Advisor Builder"

#property link "http://sufx.core.t3-ism.net/ExpertAdvisorBuilder/"

extern int MagicNumber = 0;

extern bool SignalMail = False;

extern bool EachTickMode = False;

extern double Lots = .1;

extern int Slippage = 3;

extern bool StopLossMode = True;

extern int StopLoss = 12;

extern bool TakeProfitMode = True;

extern int TakeProfit = 90;

extern bool TrailingStopMode = True;

extern int TrailingStop = 12;

#define SIGNAL_NONE 0

#define SIGNAL_BUY 1

#define SIGNAL_SELL 2

#define SIGNAL_CLOSEBUY 3

#define SIGNAL_CLOSESELL 4

int BarCount;

int Current;

bool TickCheck = False;

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

//| expert initialization function |

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

int init() {

BarCount = Bars;

if (EachTickMode) Current = 0; else Current = 1;

return(0);

}

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

//| expert deinitialization function |

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

int deinit() {

return(0);

}

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

//| expert start function |

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

int start() {

int Order = SIGNAL_NONE;

int Total, Ticket;

double StopLossLevel, TakeProfitLevel;

if (EachTickMode && Bars != BarCount) TickCheck = False;

Total = OrdersTotal();

Order = SIGNAL_NONE;

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

//| Variable Begin |

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

double Buy1_1 = iCustom("EURUSD", PERIOD_M1, "StepMA_Stoch", 2, 1, 0, 1, Current + 0);

double Buy1_2 = iCustom("EURUSD", PERIOD_M1, "StepMA_Stoch", 5, 1, 0, 1, Current + 0);

double Buy2_1 = iCustom("EURUSD", PERIOD_M1, "StepMA_Stoch", 9, 1, 0, 1, Current + 0);

double Buy2_2 = iCustom("EURUSD", PERIOD_M1, "StepMA_Stoch", 9, 1, 0, 1, Current + 1);

double Buy3_1 = iMACD("EURUSD", PERIOD_M1, 4, 9, 7, PRICE_CLOSE, MODE_SIGNAL, Current + 0);

double Buy3_2 = iMACD("EURUSD", PERIOD_M1, 4, 9, 7, PRICE_CLOSE, MODE_SIGNAL, Current + 1);

double Buy4_1 = iMA("EURUSD", PERIOD_M1, 2, 0, MODE_EMA, PRICE_CLOSE, Current + 0);

double Buy4_2 = iMA("EURUSD", PERIOD_M1, 5, 0, MODE_SMA, PRICE_CLOSE, Current + 0);

double Sell1_1 = iCustom("EURUSD", PERIOD_M1, "StepMA_Stoch", 2, 1, 0, 1, Current + 0);

double Sell1_2 = iCustom("EURUSD", PERIOD_M1, "StepMA_Stoch", 5, 1, 0, 1, Current + 0);

double Sell2_1 = iCustom("EURUSD", PERIOD_M1, "StepMA_Stoch", 9, 1, 0, 1, Current + 0);

double Sell2_2 = iCustom("EURUSD", PERIOD_M1, "StepMA_Stoch", 9, 1, 0, 1, Current + 1);

double Sell3_1 = iMACD("EURUSD", PERIOD_M1, 4, 9, 7, PRICE_CLOSE, MODE_SIGNAL, Current + 0);

double Sell3_2 = iMACD("EURUSD", PERIOD_M1, 4, 9, 7, PRICE_CLOSE, MODE_SIGNAL, Current + 1);

double Sell4_1 = iMA("EURUSD", PERIOD_M1, 2, 0, MODE_EMA, PRICE_CLOSE, Current + 0);

double Sell4_2 = iMA("EURUSD", PERIOD_M1, 5, 0, MODE_SMA, PRICE_CLOSE, Current + 0);

double CloseBuy1_1 = iMA("EURUSD", PERIOD_M1, 2, 0, MODE_SMA, PRICE_CLOSE, Current + 0);

double CloseBuy1_2 = iMA("EURUSD", PERIOD_M1, 5, 0, MODE_SMA, PRICE_CLOSE, Current + 0);

double CloseSell1_1 = iMA("EURUSD", PERIOD_M1, 2, 0, MODE_SMA, PRICE_CLOSE, Current + 0);

double CloseSell1_2 = iMA("EURUSD", PERIOD_M1, 5, 0, MODE_SMA, PRICE_CLOSE, Current + 0);

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

//| Variable End |

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

//Check position

bool IsTrade = False;

for (int i = 0; i < Total; i ++) {

OrderSelect(i, SELECT_BY_POS, MODE_TRADES);

if(OrderType() <= OP_SELL && OrderSymbol() == Symbol()) {

IsTrade = True;

if(OrderType() == OP_BUY) {

//Close

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

//| Signal Begin(Exit Buy) |

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

if (CloseBuy1_1 < CloseBuy1_2) Order = SIGNAL_CLOSEBUY;

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

//| Signal End(Exit Buy) |

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

if (Order == SIGNAL_CLOSEBUY && ((EachTickMode && !TickCheck) || (!EachTickMode && (Bars != BarCount)))) {

OrderClose(OrderTicket(), OrderLots(), Bid, Slippage, MediumSeaGreen);

if (SignalMail) SendMail("[Signal Alert]", "[" + Symbol() + "] " + DoubleToStr(Bid, Digits) + " Close Buy");

if (!EachTickMode) BarCount = Bars;

IsTrade = False;

continue;

}

//Trailing stop

if(TrailingStopMode && TrailingStop > 0) {

if(Bid - OrderOpenPrice() > Point * TrailingStop) {

if(OrderStopLoss() < Bid - Point * TrailingStop) {

OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * TrailingStop, OrderTakeProfit(), 0, MediumSeaGreen);

if (!EachTickMode) BarCount = Bars;

continue;

}

}

}

} else {

//Close

.....continued on next post

Hi Aaragorn..

Try change Lots= .1 to Lots= 0.1

 

wow what a difference one '0' can make!

it shows no errors now and in the navigator window it now is colored instead of grayshaded....

ok next i tried to backtest it with the tester and it doesn't show any results,

the report is all zeros, no graph, nothin.

message in the journal tab reads...

2006.06.13 11:58:15 macdstochma5m inputs: MagicNumber=0; Lots=0.1; Slippage=3; StopLoss=12; TakeProfit=90; TrailingStop=12;

 

CCI zero line cross

I've been searching for this on multiple net sites, googling it of course, as well as doing searches in forums themselves too for over 5 hours.

Will someone please please post an indicator of the CCI with an audio alert for when the zero line is crossed.

Very simple and not to be found anywhere...

thanks,

Someone please post the complete code for it and not just some random words assuming I'm supposed to know where to put that bit of code or how to intertwine it with the code I already have in such a way that it'll actually work. If you want to, you can make it have arrows on the chart up top too but that isn't the main thing. Just to be able to mess around the house or play games because of the audio alert without having to stare at the chart for 12 hours a day will be plenty for me.

thanks,

 

continued from last post...

deleted

 

i have two simple questions i think..

how can i make the heiken ashi Candles be thickness of 5 by default instead of 3? everytime i bring up a new chart they go back to 3.

Also, how can i make a mark above or below the candle depending on value of an RSI indicator?

I understand some about programming but don't know the syntax of this...so act like i know nothing

Thanks SO much..if i discover something, i'll post it

PS that expert advisor builder is NICE, is there and INDICATOR builder too? that would be amazing

 

Hi all...

I've made an EA that trade two diffrent currencies. And I want a function that close all trades in both currencies if they both reached x amount of profit.

I've tryed this example:

http://www.metatrader.info/node/99

But the CloseAll() function only seems to work with the currency on the chart the EA is attached to.

How do i make this CloseAll() function to work with all open trade even currencies not attached to the EA chart?

 
folioboy:
Hi all...

I've made an EA that trade two diffrent currencies. And I want a function that close all trades in both currencies if they both reached x amount of profit.

I've tryed this example:

http://www.metatrader.info/node/99

But the CloseAll() function only seems to work with the currency on the chart the EA is attached to.

How do i make this CloseAll() function to work with all open trade even currencies not attached to the EA chart?

No, CloseAll function should close all the opened orders!

Did you try it?

 
codersguru:
No, CloseAll function should close all the opened orders! Did you try it?

Yep, I did try it...

But I didnt use any magic number for my EA, maybe thats the problem.

Maybe it work if i use magic number?

 

Hmms...

I've tested lots of diffrent ways to close the orders, but the EA only seems to close the currency the EA is attached to. Maybe there is some way to use SYMBOL to close all order...

Anyone got some ide?

 

Strategy Tester glitch.....please help...

I have a friend that we are trading EA's back and forth and testing them in the strategy tester. The exact same code executes on his demo and not on mine.

When I do it on mine all I get in the journal is...

2006.06.15 13:00:21 38matrailing inputs: MagicNumber=0; Lots=1; Slippage=3; StopLoss=5; TakeProfit=60; TrailingStop=10;

2006.06.15 13:00:09 38matrailing: loaded successfully

then all the other tabs show only zeros or are blank.

in his demo account the journal shows what I get but then it launches into all the trades that it executes. What gives? Please help!

Files:
Reason: