Systems created with Zero Code beta 1

 

I created this thread to gather all systems and backtests make with Zero Code beta 1

So there is a simple system (long term system, 31 trades in 4 years) :

For eurusd 4h

- Price crosses ma 20

- Stochastic crosses up or down

- Macd crosses up or down

No stop loss

No take profit

100 pips trailing stop

Backtest start 26/04/2001 with 10000 dollars

Best result : 428 %

But the metatrader backtester close the last trade at - 8290 dollars so it reduce the result at 245 % (normally the trade will be always open but the backtesting processus close it)

Without my customs indicators, and my pivots i can't do anything

However i don't know how we can do to make the pivots on automatic trade, because it's a very discretionary system

I just post an idea and to say that we can create system that works with the amazing Zero Code, but this program need little update

We can try this system on shorter time frames, by adding an adx filter (you enter long and short only when adx is rising)

Please give many systems in this thread

 

Hi Belzebut,

wow! great system!

Sorry for this silly question. I'm a big zero when it comes to programming!

how can I write a logic that will open a trade when the price closes above

MA 'x' and close the trade when price closes below MA 'y'?

Thanks in advance,

Yasir.

 

I can tell you the last trade thing. You see, when you are ttrading without a stoploss, and ( or ) without any exit criteria , there will be some positions , which just wont be profitable. They are summed up in the last trade. So they were opened, but never got to the 100 pips, so trailing stop could not been enabled. Possible solutions:

-Add a stop loss

-Add some closing position criteria ( for example , macd is crossing back, or stochastic is closing back and so on )

- Lower the trailing stop level, from say 100 pips to 50 pips.

I would prefer a combination of an exit criteria and reduced trailing stop. Only to get the best exit criteria you have to do some research. Let us know how it goes.

 

Ok Ravique, i wasn't know that all unprofitable trades are summed up in last trade, thanks

But as i say, it's just a little try of Zero Code beta 1.

Because without our customs indicators we are poor guys

 

Yasirdxb, this is for you :

I think this is right, but i ask confirmation to old members

Actually I think Zero Code can recognize when the price crosses with ma, and not when he closes up or down the ma ????

 

Ok, below code is to Buy when bid price closes above MA(1) and Close the position when bid price closes below MA(1).

Note that I use "Volume < 10" to check for a new candle.

Files:
zerocode_5.png  19 kb
 
Ravique:
I can tell you the last trade thing. You see, when you are ttrading without a stoploss, and ( or ) without any exit criteria , there will be some positions , which just wont be profitable. They are summed up in the last trade. So they were opened, but never got to the 100 pips, so trailing stop could not been enabled.

Is that a bug of MetaTrader Backtester? I don't know that thing before.

 

Well, it is not a bug. C for yourself. If an expert open positions , and has no exit criteria or stopp loss , then theese positions would be open until they will reack take profit , or until they will eat your account up. So the backtester just closes them at the end of backtesting and this last trade shows the actual opened position loss. Maybe someday they will be profitable, they say that the market goes up and down always.

 

Thank you very much Guys

I created a simple trend following strategy! but when i tried to include both buying and selling logic to one expert, it was not working correct. may be I am wrong.

please check this for me.

Here is what I wanted,

Buy when price closes above 89 ema high

close when price closes below 21 em low

-------------------------------------

Sell when price closes below 89 ema low

close when price closes above 21 ema high

==============================

I have attached the expert and screenshots. Please tell me how can I include both logics to one expert.

======================================================

//*---------------------------------------------------------------------------------------------------------*\

// This MQL is automatically generated by FXFisherman ZeroCode v1.0.1982.33196 (https://www.mql5.com/en/forum)

//

// DISCLAIMER:

//

// FXFisherman ZeroCode is provided free of charge, and, therefore, on an "as is" basis, without warranty

// of any kind, express or implied, including without limitation the warranties that it is free of defects,

// virus free, able to operate on an uninterrupted basis, merchantable, fit for a particular purpose or

// non-infringing. In any case, the author(s) will not be responsible or liable for ANY SPECIAL, INCIDENTAL,

// CONSEQUENTIAL, INDIRECT OR ANY OTHER LOSSES caused by using of this software. USE IT AT YOUR OWN RISK.

//

//*-----------------------------------PLEASE DO NOT REMOVE THIS HEADER--------------------------------------*/

/*[[ Name := Trend trader

Author := Yasir

Link := Coded_by_FXFisherman_ZeroCode_@www.fxfisherman.com

Lots := 1

Stop Loss := 0

Take Profit := 0

Trailing Stop := 0

]]*/

defines: Slippage(3);

defines: ;

var: cnt(0),IsBuying(False),IsSelling(False),IsClosing(False),RealTP(0),RealSL(0);

var: ma1_1(0),ma1_0(0),ma2_1(0),ma2_0(0);

// Check for invalid bars and takeprofit

If Bars<200 then Exit;

// Calculate indicators' value

ma1_1 = iMAEx(89,MODE_EMA,0,PRICE_HIGH,1);

ma1_0 = iMAEx(89,MODE_EMA,0,PRICE_HIGH,0);

ma2_1 = iMAEx(21,MODE_EMA,0,PRICE_LOW,1);

ma2_0 = iMAEx(21,MODE_EMA,0,PRICE_LOW,0);

// Check for BUY, SELL, and CLOSE signal

IsBuying = (PriceBid > ma1_0)

and (Volume < 10);

IsSelling = False;

IsClosing = (PriceBid < ma2_0)

and (Volume < 10);

// Control open trades

for cnt=1 to TotalTrades

{

// Control only market trades not entry order

if OrderValue(cnt,VAL_TYPE)<=OP_SELL and

OrderValue(cnt,VAL_SYMBOL)=Symbol then

{

// Check for close signal for bought trade

If OrderValue(cnt,VAL_TYPE)=OP_BUY then

{

If IsSelling or IsClosing then

{

// Close bought trade

CloseOrder(OrderValue(cnt,VAL_TICKET),OrderValue(cnt,VAL_LOTS),Bid,3,Violet);

Alert("Trend trader: Closing BUY order.");

};

// Check trailing stop

If TrailingStop>0 then

{

If (Bid-OrderValue(cnt,VAL_OPENPRICE))>(Point*TrailingStop) then

{

If OrderValue(cnt,VAL_STOPLOSS)<(Bid-Point*TrailingStop) then

{

// Modify trailing stop

ModifyOrder(OrderValue(cnt,VAL_TICKET),OrderValue(cnt,VAL_OPENPRICE),

Bid-Point*TrailingStop,OrderValue(cnt,VAL_TAKEPROFIT),Red);

};

};

};

}

else

{

// Check sold trade for close signal

If IsBuying or IsClosing then

{

CloseOrder(OrderValue(cnt,VAL_TICKET),OrderValue(cnt,VAL_LOTS),Ask,3,Violet);

Alert("Trend trader: Closing SELL order.");

};

// Control trailing stop

If TrailingStop>0 then

{

If (OrderValue(cnt,VAL_OPENPRICE)-Ask)>(Point*TrailingStop) then

{

If OrderValue(cnt,VAL_STOPLOSS)=0 or

OrderValue(cnt,VAL_STOPLOSS)>(Ask+Point*TrailingStop) then

{

ModifyOrder(OrderValue(cnt,VAL_TICKET),OrderValue(cnt,VAL_OPENPRICE),

Ask+Point*TrailingStop,OrderValue(cnt,VAL_TAKEPROFIT),Red);

};

};

};

};

};

};

// If there is no open trade

If TotalTrades<1 then

{

// If we have enough money for 1 lot

If FreeMargin<1000 then Exit;

// Check for BUY entry signal

If IsBuying and IsSelling=False and IsClosing=False then

{

// Buy

If StopLoss>0 then

{

RealSL=Ask-StopLoss*Point;

}

If TakeProfit>0 then

{

RealTP=Ask+TakeProfit*Point;

}

SetOrder(OP_BUY,Lots,Ask, Slippage,RealSL,RealTP,RED);

Alert("Trend trader: Buying");

};

// Check for SELL entry signal

If IsSelling and IsBuying=False and IsClosing=False then

{

// Sell

If StopLoss>0 then

{

RealSL=Bid+StopLoss*Point;

}

If TakeProfit>0 then

{

RealTP=Bid-TakeProfit*Point;

}

SetOrder(OP_SELL,Lots,Bid,Slippage,RealSL,RealTP,RED);

Alert("Trend trader: Selling");

};

};

//-------------- Coded by FXFisherman ZeroCode v1.0.1982.33196

====================================================

Files:
report.jpg  51 kb
 

Hi bezlebut,

Can you post the equity curve of the system?

For me the smoothness of that curve is very important.

About closing the last open trade.

I agree with you it shouldn't be in the calulations.

We would need and extra 'unrealized p/l' entry.

But the report is medicore are best anyway.

Everything is calculated with the amount of cash in your account.

($10000)

But in reality the system only uses $1000 + required margin.

 

TraderSeven,

I'm sorry but i deleted my system, so i can't post the equity curve

But i search in other ways, and i want to wait a little to tell you all guys, when the system will be more profitable (i'm waiting the customs indicators support )

Reason: