I can create your Expert advisor for free

Hi Jcl,

I’m reading your tutorials as we speak. You’ve done a great job! Many thanks!

I’m not 100 % how things work yet. This program Zorro, is this like a trading-programme like MT4, that shows charts and other technical indicators? Or do you like “apply” zorro to another trade-programme. I hope you understand what I mean.

Regards

Zorro is a stand alone program, it does not need MT4. But it is not for manual trading, only for automated trading. It can show charts and indicators for developing strategies, but it has no realtime chart windows where you manually enter trades.

So… if I wish to start trade with Zorro. How to open an account etc?

I’m really grateful that you answer mig questions, thanks again.

regards

For opening an account you need a broker that is supported by Zorro. Currently Zorro supports FXCM, but you can add any other broker that has either a trade API, or has a website where you can place trades. You can find details about this in the Zorro manual.

jcl365 makes unjustified claims that makes zorro look better…

I am not stating that Zorro suxx, just that jcl365 provides incorrect information…

Some claims:

MT4 is probably not the best tool for measuring slippage, as it has a hidden feature to add artificial slippage - which can be much higher - to the slippage of the broker.

Partly true… True that brokers can utilize such a feature… This is option is offered by ECN’s and it is included in MT4. But this is not limited to MT4. Brokers can also add artificial slippage through their websites or before sending the signal back to zorro. Zorro or jcl365 scripts don’t prevent this.

MT4 is not suited for automated trading, for many reasons.

Not true, MT4 can and is used for automated trading.

This is all what is needed when you use a serious language, such as C in the Zorro software. In MQL4 you would need 10x more code and 20x more time.

This is not true. In Zorro there is also more code required, but that is included in the package. Such can also be available in MT4. This has nothing to do with C or MQL. The extra code is just tucked away in Zorro, but based on the script you shown you cannot place a trade using only C as a language, more is required.

Currently Zorro supports FXCM, but you can add any other broker that has either a trade API, or has a website where you can place trades. You can find details about this in the Zorro manual.

This is not true, it only applies to brokers that use the same API as FXCM. Still curious how you want to avoid the artificial slippage when trading over websites.

Well, 4 is enough to at least show that I gave it some energy to state my claim.

Hi Toekan,

Thanks for sharing your view of opinion :). Are you too into automated trading? Do you trade with MT4?

You gave some energy, only problem is that you’re mostly wrong.

I am aware that MT4 is used for automated trading by the poor guys who know nothing else. I’m only saying that it is not suited for this purpose.

MQL4 lacks native language support for pointers, structs, type casting, or data series. This requires a huge number of system functions and results in the lengthy ‘spaghetti code’ that is typical for EAs. MQL4 has many other surprises: the main script is started every tick, thus the current price candle is normally incomplete, and the last full candle has the index 1, not 0 as in other platforms. Many MQL4 standard indicators - ATR for instance - are calculated differently. EAs often require account dependent corrections, such as for the digit number of price quotes or for NFA compliant orders. Most EA programmers have therefore developed their own code framework for handling all the special cases. Due to the extra code, MQL4 EAs are long and intransparent compared to scripts of other platforms.

An even worse problem is that MT4 has no serious test system. How would you optimize a strategy without testing it? MT4 can only run primitive in sample backtests, and even them extremely slow because MQL4 is interpreted and not compiled.

No developer that I know would use MT4 for developing automated trade strategies.

This is an example of an extremely simple EA in MT4:

// enter a trade when the RSI12 crosses over 75 or under 25
int start()
{
// get the previous and current RSI values
   double current_rsi = iRSI(Symbol(), Period(), 12, 
     PRICE_CLOSE, 1); // mind the '1' - candle '0' is incomplete!!
   double previous_rsi = iRSI(Symbol(), Period(), 12, PRICE_CLOSE, 2);
 
// set up stop / profit levels
   double stop = 200*Point;
   double takeprofit = 200*Point;

// correction for prices with 3 or 5 digits
   int digits = MarketInfo(Symbol(), MODE_DIGITS);
   if (digits == 5 || digits == 3) {
     stop *= 10;
     takeprofit *= 10;
   }

// find the number of trades 
   int num_long_trades = 0;
   int num_short_trades = 0;
   int magic_number = 12345;

// exit all trades in opposite direction
   for(int i = 0; i < OrdersTotal(); i++)
   {
// use OrderSelect to get the info for each trade
     if(!OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) 
       continue;
// Trades not belonging to our EA are also found, so it's necessary to
// compare the EA magic_number with the order's magic number
     if(magic_number != OrderMagicNumber()) 
       continue;

     if(OrderType() == OP_BUY) {
// if rsi crosses below sell level, exit long trades
       if((current_rsi < 25.0) && (previous_rsi >= 25.0))
         OrderClose(OrderTicket(), OrderLots(), 
           Bid, 3, Green);
       else
// otherwise count the trades
         num_long_trades++;
     }
 
     if(OrderType() == OP_SELL) {
// if rsi crosses over buy level, exit short trades 
       if((current_rsi > 75.0) && (previous_rsi <= 75.0))
         OrderClose(OrderTicket(), OrderLots(), 
           Ask, 3, Green);
       else
// otherwise count the trades
         num_short_trades++;
     }
   }
 
// if rsi crosses over buy level, enter long 
   if((current_rsi > 75.0) && (previous_rsi <= 75.0) 
     && (num_long_trades == 0)) {
     OrderSend(Symbol(), OP_BUY, 
       1.0, Ask, 3,
       Ask-stop, Bid+takeprofit, 
       "", magic_number, 
       0, Green);
   }
// if rsi crosses below sell level, enter short
   if((current_rsi < 25.0) && (previous_rsi >= 25.0) 
     && (num_short_trades == 0)) {
     OrderSend(Symbol(), OP_SELL, 
       1.0, Bid, 3, 
       Bid+stop, Ask-takeprofit, 
       "", magic_number, 
       0, Green);
   }
 
   return(0); 
}

This is the same EA in lite-C:

// enter a trade when the RSI12 crosses over 75 or under 25
function run()
{
// get the RSI series
  vars rsi = series(RSI(series(priceClose()),12));
 
// set up stop / profit levels
  Stop = 200*PIP;
  TakeProfit = 200*PIP;
 
// if rsi crosses over buy level, exit short and enter long
  if(crossOver(rsi,75)) {
    exitShort();
    if(NumOpenLong == 0) enterLong();
  }
// if rsi crosses below sell level, exit long and enter short
  if(crossUnder(rsi,25)) {
    exitLong();
    if(NumOpenShort == 0) enterShort();
  }
}

Do you notice the difference?

Oh yeah, I notice a difference…:slight_smile:

A. You included the zorro code and ninja code in your MT4 example
B. You included the trade management in the MT4 example, and excluded it in your Zorry example. In MT4 this can be implemented with a copy and paste or with an import to a function.
C. In the Zorro script you are not checking it there are open orders, but you included that in the MT4 example. In Zorro you are just coding NumOpenLong == 0.

Excluding this the size of the code is relative about the same…:slight_smile:

Anyway, I leave it to the others to judge. Otherwise I would be trolling…:slight_smile:

Yes, I trade automated and use MT4… And it is great that there is an free alternative and if it is good it should be used. I am just not comfortable with how it is promoted here… But that was not part of your question…:slight_smile:

So, Yes and Yes…:slight_smile:

No. Both codes are stripped to the minimum and have exactly the same functions. They open and close the same trades in a backtest. The “trade management” is required for MT4 - the code would not work without.

This is a simple system, but in complex and more realistic strategies, the MT4 overhead is even worse. The size of MT4 code compared to code of other platforms can be easily 10:1.

Sneaky, you excluded A…:smiley: Admit it…:slight_smile: I can get it back from the update emails…:slight_smile:

Not going to challenge you on it anymore… I stand with my statement… The original comparison is not very fair. But any coder can see that for themselves.

I admit it, but you have been sort of slow :slight_smile: - I removed the wrong Ninja code right after my posting, but you responded 20 minutes later and had not yet noticed it.

Hello community!

I am an absolute rooky in “programming” indicators or expert adisors. I am not a programmer, but I will do my very best for understanding the code, before combining it with code from other indicators. So I am not programmer, but rather a “combiner”. :slight_smile:

But now I have a problem I cannot solve for myself and I hope that somebody can help me.

In the attachment you will find a simple regression indicator. I added an alert what will be executed when the price touches the borderline of the regression channel. Now I want to execute not only an alert, but also an order.For this I need an EA not an indicator. I can add a standard indicator in MT4 with “iMA” for example, if I want to use a moving average. But how can I implement my own indicator??? For the EA I need the calculation of the regression indicator. Can somebody show me please, how to implement the code of the indicator in the EA? I really don´t know what to do. :frowning:

THANKS A LOT!!!

Best regards
Christian

//±-----------------------------------------------------------------+
//| Linear Regression.mq4 |
//| Copyright © 2006, tageiger, aka
//|
//±-----------------------------------------------------------------+
#property copyright "Copyright © 2006, tageiger,
#property link
#property indicator_chart_window

extern int period=0;
/default 0 means the channel will use the open time from “x” bars back on which ever time period
the indicator is attached to. one can change to 1,5,15,30,60…etc to “lock” the start time to a specific
period, and then view the “locked” channels on a different time period…
/
extern int line.width=2;
extern int LR.length=100; // bars back regression begins
extern color LR.c=Magenta;
extern double std.channel.1=2.0;
extern color c.1=Magenta;
extern double AlertChannelPips=0.003;
//extern double SL_Pips=0.005 //will be needed when open a position
extern int AlertOn=1;

int init(){return(0);}

int deinit(){ ObjectDelete(period+“m “+LR.length+” TL”);
ObjectDelete(period+“m “+LR.length+” +”+std.channel.1+“d”); ObjectDelete(period+“m “+LR.length+” -”+std.channel.1+“d”);

return(0);}

int start(){//refresh chart
ObjectDelete(period+“m “+LR.length+” TL”);
ObjectDelete(period+“m “+LR.length+” +”+std.channel.1+“d”); ObjectDelete(period+“m “+LR.length+” -”+std.channel.1+“d”);

//linear regression calculation
int start.bar=LR.length, end.bar=0;
int n=start.bar-end.bar+1;
//---- calculate price values
double value=iClose(Symbol(),period,end.bar);
double a,b,c;
double sumy=value;
double sumx=0.0;
double sumxy=0.0;
double sumx2=0.0;
for(int i=1; i<n; i++)
{
value=iClose(Symbol(),period,end.bar+i);
sumy+=value;
sumxy+=valuei;
sumx+=i;
sumx2+=i
i;
}
c=sumx2n-sumxsumx;
if(c==0.0) return;
b=(sumxyn-sumxsumy)/c;
a=(sumy-sumxb)/n;
double LR.price.2=a;
double LR.price.1=a+b
n;

//---- maximal deviation calculation (not used)
double max.dev=0;
double deviation=0;
double dvalue=a;
for(i=0; i<n; i++)
{
value=iClose(Symbol(),period,end.bar+i);
dvalue+=b;
deviation=MathAbs(value-dvalue);
if(max.dev<=deviation) max.dev=deviation;
}
//Linear regression trendline
ObjectCreate(period+“m “+LR.length+” TL”,OBJ_TREND,0,iTime(Symbol(),period,start.bar),LR.price.1,Time[end.bar],LR.price.2);
ObjectSet(period+“m “+LR.length+” TL”,OBJPROP_COLOR,LR.c);
ObjectSet(period+“m “+LR.length+” TL”,OBJPROP_WIDTH,line.width);
ObjectSet(period+“m “+LR.length+” TL”,OBJPROP_RAY,false);
//…standard deviation…
double x=0,x.sum=0,x.avg=0,x.sum.squared=0,std.dev=0;
for(i=0; i<start.bar; i++) {
x=MathAbs(iClose(Symbol(),period,i)-ObjectGetValueByShift(period+“m “+LR.length+” TL”,i));
x.sum+=x;
if(i>0) {
x.avg=(x.avg+x)/i;
x.sum.squared+=(x-x.avg)(x-x.avg);
std.dev=MathSqrt(x.sum.squared/(start.bar-1)); } }
//Print("LR.price.1 “,LR.price.1,” LR.Price.2 “,LR.price.2,” std.dev ",std.dev);
//…standard deviation channels…
ObjectCreate(period+“m “+LR.length+” +”+std.channel.1+“d”,OBJ_TREND,0,iTime(Symbol(),period,start.bar),LR.price.1+std.dev
std.channel.1,
Time[end.bar],LR.price.2+std.dev*std.channel.1);
ObjectSet(period+“m “+LR.length+” +”+std.channel.1+“d”,OBJPROP_COLOR,c.1);
ObjectSet(period+“m “+LR.length+” +”+std.channel.1+“d”,OBJPROP_WIDTH,line.width);
ObjectSet(period+“m “+LR.length+” +”+std.channel.1+“d”,OBJPROP_RAY,false);

ObjectCreate(period+“m “+LR.length+” -”+std.channel.1+“d”,OBJ_TREND,0,iTime(Symbol(),period,start.bar),LR.price.1-std.devstd.channel.1,
Time[end.bar],LR.price.2-std.dev
std.channel.1);
ObjectSet(period+“m “+LR.length+” -”+std.channel.1+“d”,OBJPROP_COLOR,c.1);
ObjectSet(period+“m “+LR.length+” -”+std.channel.1+“d”,OBJPROP_WIDTH,line.width);
ObjectSet(period+“m “+LR.length+” -”+std.channel.1+“d”,OBJPROP_RAY,false);

// ALERT

// Alert channel width
double DefChannelBorderTop.1=LR.price.2+std.devstd.channel.1;
double DefChannelBorderBottom.1=LR.price.2-std.dev
std.channel.1;

// Trend DOWN
if (
(LR.price.1 > LR.price.2) &&
((DefChannelBorderTop.1)-(DefChannelBorderBottom.1)) > (AlertChannelPips) &&
(Ask > LR.price.2+std.dev*std.channel.1) &&
(AlertOn > 0)
)
{
PlaySound(“alert.wav”);
AlertOn = 0; // Alert will be switched off after trigger!
//---------------------
//Instead of the Alert an order should be executed:
//ONLY IF POSITION IS FLAT!! NO OPEN ORDERS!!
//EXECUTION WHEN PRICE TOUCHES LINE! NOT AFTER CLOSING THE BAR!
//Direction: SHORT
//Stopp Loss: SL_Pips
//Position size: By using SL_Pips, the risk must be 1% of the account balance.
//Take profit: DefChannelBorderBottom.1, if possible the TP should be adjusted with every new bar.
//---------------------
}

// Trend UP
if (
(LR.price.1 < LR.price.2) &&
((DefChannelBorderTop.1)-(DefChannelBorderBottom.1)) > (AlertChannelPips) &&
(Bid < LR.price.2-std.dev*std.channel.1) &&
(AlertOn > 0)
)
{
PlaySound(“alert.wav”);
AlertOn = 0; // Alert will be switched off after trigger!
//---------------------
//Instead of the Alert an order should be executed:
//ONLY IF POSITION IS FLAT!! NO OPEN ORDERS!!
//EXECUTION WHEN PRICE TOUCHES LINE! NOT AFTER CLOSING THE BAR!
//Direction: LONG
//Stopp Loss: SL_Pips
//Position size: By using SL_Pips, the risk must be 1% of the account balance.
//Take profit: DefChannelBorderTop.1, if possible the TP should be adjusted with every new bar.
//---------------------
}

return(0);}
//±-----------------------------------------------------------------+

Hi Venichhe, I’ve bought an expensive robot,but the seller only coded it to run on demo account only but not the real live account. And the bad news is I couldn’t find the seller as he is disappear to nowhere.

I was wondering if can you help me to make the robot works on live account?

Please help me with this strategy. It’s the combination of 100 EMA and stoch(8,3,3)

Sell Trades:

  1. Price must be below the EMA(100) line. Furthermore at least the previous candle must have closed below the EMA. As you will notice price does not cross the EMA very often, when it does it is quite significant and normally implies that a change in the trend is imminent. Therefore, as we want to minimise trading risk, we wait until price is established below the EMA.

  2. Once the first condition has been met, we now focus on the stochastic indicator. The fast stochastic line must have crossed over the slow stochastic line from above and it must be between 20 and 80. If the cross has occurred between 100 and 80, we must wait until the stochastic crosses the 80 line.

  3. Once the stochastic criteria have been met, place a sell trade at the opening of the very next daily candle.

  4. Place a stop loss 150 pips above the entry price. If you are trading a more active currency pair like the GBPUSD, where price swings can be large, the stop loss should be at least 200 pips. Remember you are dealing with the Daily charts, not the 1H or 15M charts so the stop loss level needs to be appropriate for the time frame used.

  5. Assuming that the trade is moving with the trend in the anticipated direction, price at some point will hopefully show a gain of +100 pips. When this has occurred, move the stop loss position to the entry price, to ensure the remainder of the trade is risk free.

  6. Close the trade at the end of the daily candle when the 2 stochastic lines cross once again. For a trade close-out, it does not matter where the two lines cross on the stochastic indicator channel.

Buy Trades

  1. Price must be above the EMA(100) line. Furthermore at least the previous candle must have closed above the EMA. As you will notice price does not cross the EMA very often, when it does it is usually quite significant and normally implies that a change in the trend is imminent. Therefore, as we want to minimise trading risk, we wait until price is established above the EMA.

  2. Once the first condition has been met, we now focus on the stochastic indicator. The fast stochastic line must have crossed the slow stochastic line from underneath and it must be between 20 and 80. If the crossover has occurred between 0 and 20, we must wait until the stochastic crosses the 20 line.

  3. Once the stochastic criteria have been met, place a buy trade at the opening of the very next daily candle.

  4. Place a stop loss 150 pips above the entry price. If you are trading a more active currency pair like the GBPUSD, where price swings can be very large, the stop loss should be at least 200 pips. Remember you are dealing with the Daily charts, not the 1H or 15M charts, so the stop loss level needs to be appropriate for the time frame used.

  5. Assuming that the trade is moving with the trend in the anticipated direction, price at some point will hopefully show a gain of +100 pips. When this has occurred, move the stop loss position to the entry price, to ensure the remainder of the trade is risk free.

  6. Close the trade at the end of the daily candle when the 2 stochastic lines have crossed once more. For a close-out, it does not matter where the stochastic lines cross on the stochastic indicator channel.

hi, please help me make the ea to 301 Moved Permanently thanks in advance

i cant really tell. but you can ask some forex expert about it. try to ask mario singh.fx news

hi, can you help me create a simple ea based on the criteria :

  1. buy & sell at the same price at open candle (00:00 GMT Broker time)
  2. with Lot, SL, TP, Trailing stop & Trailing Step option.

Thanks in advance… :slight_smile:

i recently downloaded a file called level scalper
in theory it would work good but it has a few errors that need to be corrected

what it does is puts a number of pending buy orders and sell orders on either side
when they are reached they are put into the market

the stop losses of the buy/sell equal out to be the take profits of the sell and buy respectively
so theoretically you would never lose any money but if the market swings you could earn very little

the problem with the script is it puts an unequal number of buys or sells so that you could still lose money
if the market swings

i would like you to program a perfectly balanced hedging scalper system that does what this level scalper should do
4 buys and 4 sells on either side with stop loss equaling take profits

Hello friends, i just calculated a strategy and did it manually for sometime. i got good results. i want to make this strategy into a EA. i don’t know mql4. so i request to make this strategy into a EA.

Here is the strategy.

  1. Find current rate
    When I open computer and start meta trade platform what is the shown price in all currency pairs, commodities, that is a current rate
    For example one pair
    If Current Rate is – 1300
    Compulsory put pending buy order and pending sell order
    Buy Order Sell Order

  2. buy 1310 – T.P 1320 - S.L 1300 sell 1290 – T.P 1280 - S.L 1300

  3. buy 1320 – T.P 1330 - S.L 1310 sell 1280 – T.P 1270 - S.L 1290

  4. buy 1330 – T.P 1340 - S.L 1320 sell 1270 – T.P 1260 - S.L 1280

  5. buy 1340 – T.P 1350 - S.L 1330 sell 1260 – T.P 1250 - S.L 1270

  6. buy 1350 – T.P 1360 - S.L 1340 sell 1250 – T.P 1240 - S.L 1260

  7. Etc ( if depend on profit) Etc ( if depend on profit)

  8. if touch 1320 profit same this side put buy order
    Put sell order
    sell 1310 – T.P 1300 – S.L-1320

  9. if touch 1330 profit
    Put sell order
    sell 1320 – T.P 1310 – S.L-1330
    sell 1310 – T.P 1300 – S.L-1320

  10. if touch 1340 profit
    Put sell order
    sell 1330 – T.P 1320 – S.L-1340
    Up to how many buy orders
    And
    same this side put sell orders
    If going on touch T.k profit 1360 and down 1270
    Again market going above
    You put buy orders start with 1300 – T.K 1310 - S.L. 1290

Finally whatever market is going up and down we need a every 10 pips profit for all pairs

Trailing stop for each orders should be 5.