Gamestudio Links
Zorro Links
Newest Posts
rMomentum always returns 0 when checking for peak/valley
by jcl
Today at 17:38
a little help here?
by 3run
Today at 16:38
How to set a pair trading order right
by jcl
Today at 11:46
Dual Momentum Algorithm - The way Zorro would have done it
by Hredot
Today at 05:21
HIgh FRequency Trading Script -- Highly Profitable
by Yosh
Yesterday at 19:27
Linear Regression in objective function
by jcl
11/22/17 15:40
MT4 vs Zorro
by pascalx
11/22/17 14:00
AUM Magazine
Latest Screens
RPG PARTY
Triton Wing now available on Steam
AckCon'17: Lotter vs The World
Triton Wing
Who's Online
14 registered (Lobo, Hredot, painkiller, 3run, alibaba, Kartoffel, FLD, RealSerious3D, Jerome8911, 1 invisible), 169 Guests and 4 Spiders online.
Key: Admin, Global Mod, Mod
Newest Members
ech87, Lobo, Andy60, AzzoCorp, franzz
17813 Registered Users
Page 5 of 6 < 1 2 3 4 5 6 >
Topic Options
Rate This Topic
#464581 - 02/27/17 17:56 Re: Z System result sharing? [Re: RTG]
sodiumchloride Offline
Newbie

Registered: 02/17/17
Posts: 23
SR 0.06, lots of drawdowns but running stable for years - very interesting...

Quote:
"Thatís a robot that looks for short-term divergences Ė in other words, discrepancies between the movement of price and the momentum at which itís moving.
and hes amount of trades is correlated with high volatility."

Top
#464712 - 03/07/17 02:59 Re: Z System result sharing? [Re: sodiumchloride]
RTG Offline
Member

Registered: 02/23/14
Posts: 161
I've found out a little more about this approach from the website. It shouldn't be hard to code this for Zorro and test it.

THE FINCH
The Finch robot looks for divergences on a 5 minute chart. When it finds a divergence, it will take a trade. If the trade is a loser, it will look for one more trade. If that second trade is a loser, the robot will either close all the trades or stay in the trades until they come back (you can tell the robot to choose either style of trading). Most people who buy the robots run Finch on 3-5 currency pairs, and let the robot run on its own.

Top
#464782 - 03/12/17 06:34 Re: Z System result sharing? [Re: RTG]
RTG Offline
Member

Registered: 02/23/14
Posts: 161
Found the MT4 code for what I believe is this system. Seems a bit long complex. I think it would be far shorter in Zorro.

//+------------------------------------------------------------------+
//| Trifecta Automatic.mq4 |
//| Copyright 2015, Rob Booker |
//| http://www.tfl365.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2015, Rob Booker"
#property link "http://www.tfl365.com"
#property version "ao-20160122 21.56"
#property icon "\Images\Rob-Booker_S2-64.ico"
#property description "Added code as preemptive measure to avoid trade timeout error."
#property description "Added code to deal with manually deleted second trade."
#property description "ao-20160105 20.31: with correct magic number EA regains control of"
#property description "its trades. Trade functions repeated after errors."
/*
#property description "ao-20160105 20.31: Reliability enhancement of Rollover Finch v1.9.mq4 from"
#property description "Rollover_Finch_v1.9.zip, available at TFL Membership at /tfl.mykajabi.com."
#property description "Modified init() so EA regains control of trades it made. Make sure you"
#property description "specify the correct Magic number."
#property description "Modified OpenTrade() and CloseAllTrades() so trade functions will repeat"
#property description "if errors occur. Status information and errors are printed in the Experts log"
#property description "to inform you of what's going on."
*/
#property strict

#include <stdlib.mqh>
#include <stderror.mqh>

extern string WARNING = "Using a robot carries risk, use on demo account FIRST";
extern int Slippage=5;
extern int Max_Spread_Pips=5;
extern int Magic = 12345;

extern double First_Trade_Lots=0.05;
extern double Second_Trade_Lots=0.5;

extern int Pips_To_Trade_2 = 10;

extern string Stop_Type="Default no stop loss";
extern int Stop_Loss_In_Pips=0;

extern string Profit_In_Dollars = "Profit Targets in Dollar Value format";
extern double First_Trade_Profit_In_Dollars=10.0;
extern double Second_Trade_Profit_In_Dollars=100.0;

extern bool Break_Even = false;
extern double Break_Even_At_Profit = 50.0;

extern int CandlesBack = 30;
extern int RSIPeriod = 21;
extern int MomentumPeriod = 20;
extern int FastMAPeriod=12;
extern int SlowMAPeriod=26;
extern int SignalMAPeriod=9;
extern int KPeriod=70;
extern int DPeriod=10;
extern int Slowing=10;
extern int Stochastic_Upper=70;
extern int Stochastic_Lower=30;

extern bool Mail_Alert = false;
extern bool PopUp_Alert = false;
extern bool Sound_Alert = false;
extern bool SmartPhone_Notifications=false;

double UsePoint;
int UseSlippage;

double Order_Stop;

datetime TheTime;

int LastKDB;
int LastKDS;

double Order_Profit;

string Order_Type = "BuySell";
double PriceForSecond;

bool BreakEven=false;

int TotalTrades=0;

bool BuysNotAllowed=false;
bool SellsNotAllowed=false;

int Tickets[2] = {0, 0};

int init() {
int i = 0, x;
string info = "";

if (!IsTradeAllowed() || !IsExpertEnabled())
Alert("Trading is not allowed / Expert is not enabled");

UsePoint = PipPoint(Symbol());
UseSlippage = GetSlippage(Symbol(),Slippage);

for(x = 0; x < OrdersTotal(); x++)
if (OrderSelect(x, SELECT_BY_POS, MODE_TRADES))
if (OrderSymbol() == Symbol() && OrderMagicNumber() == Magic) {
Tickets[i++] = OrderTicket();
info += ", #" + IntegerToString(OrderTicket());
if (OrderType() == OP_BUY) {
Order_Type = "Buy";
if (i == 1) {
PriceForSecond = OrderOpenPrice() - (Pips_To_Trade_2 * UsePoint);
Order_Stop = OrderOpenPrice() - (Stop_Loss_In_Pips * UsePoint);
}
}
else {
Order_Type = "Sell";
if (i == 1) {
PriceForSecond = OrderOpenPrice() + (Pips_To_Trade_2 * UsePoint);
Order_Stop = OrderOpenPrice() + (Stop_Loss_In_Pips * UsePoint);
}
}
}
TotalTrades = i;
Print("Init: Total " + Order_Type + " Trades = " + IntegerToString(TotalTrades) + info);

return(0);
}

int deinit()
{
return(0);
}

int start() {
if (TotalTrades) {
CheckProfit();
Comment(Order_Type + " Trades: " + IntegerToString(TotalTrades));
}
else
Comment("");

if (TotalTrades == 2)
return(0);

if(TheTime<Time[1])
{
if(!BuysNotAllowed && ((Order_Type=="BuySell" && TotalTrades==0) || (Order_Type=="Buy" && TotalTrades==1 && Bid<=PriceForSecond)) && RSIBuyCheck(1)) OpenTrade("Buy");

if(!SellsNotAllowed && ((Order_Type=="BuySell" && TotalTrades==0) || (Order_Type=="Sell" && TotalTrades==1 && Bid>=PriceForSecond)) && RSISellCheck(1)) OpenTrade("Sell");

TheTime=Time[1];
}
return(0);
}

void CheckProfit() {
double Profits=0.0;

for (int x = 0; x < TotalTrades; x++)
if (OrderSelect(Tickets[x], SELECT_BY_TICKET) && OrderCloseTime() == 0)
Profits += OrderProfit();
else if (x == 1) { // second trade closed manually
Tickets[x] = 0;
TotalTrades--;
}

if ((TotalTrades == 1 && Profits >= First_Trade_Profit_In_Dollars) ||
(TotalTrades == 2 && Profits >= Second_Trade_Profit_In_Dollars) ||
(Stop_Loss_In_Pips > 0 && TotalTrades > 0 && Order_Type == "Buy" && Ask <= Order_Stop) ||
(Stop_Loss_In_Pips > 0 && TotalTrades > 0 && Order_Type == "Sell" && Bid >= Order_Stop)) {
Print("Profit is " + DoubleToString(Profits, 2));
CloseAllTrades();
return;
}

if (Break_Even && !BreakEven && Profits >= Break_Even_At_Profit) {
Print("Rollover Finch Break Even Begin");
BreakEven = true;
}
if (Break_Even && BreakEven && Profits <= 0)
CloseAllTrades();

return;
}

void CloseAllTrades() {
int i, TT = TotalTrades, GLE;
string info;

if (!IsConnected()) {
Print("CloseAllTrades(: " + TimeToString(TimeCurrent(), TIME_DATE | TIME_SECONDS) + " IsConnected() is false");
return;
}
if (IsTradeContextBusy()) {
Print("CloseAllTrades(: " + TimeToString(TimeCurrent(), TIME_DATE | TIME_SECONDS) + " IsTradeContextBusy() is true");
return;
}

for (int x = 0; x < TT; x++) {
if (OrderSelect(Tickets[x], SELECT_BY_TICKET)) {
if (OrderType() == OP_BUY) {
for (i = 0; i < 10 && !OrderClose(OrderTicket(), OrderLots(), Bid, UseSlippage, clrRed); i++) {
GLE = GetLastError();
info = TimeToString(TimeCurrent(), TIME_DATE | TIME_SECONDS) + " OrderClose(#" +
IntegerToString(OrderTicket()) + ", " + DoubleToString(OrderLots(), 2) +
", " + DoubleToString(Bid, Digits) + " (Bid), " + IntegerToString(UseSlippage) +
"): " + DescribeError(GLE);
Print(info);
if (GLE && IsFatalTradeError(GLE))
break;
Sleep(3000);
RefreshRates();
}
if (i < 10) {
Tickets[x] = 0;
TotalTrades--;
}
}
else if (OrderType()==OP_SELL) {
for (i = 0; i < 10 && !OrderClose(OrderTicket(), OrderLots(), Ask, UseSlippage, clrGreen); i++) {
GLE = GetLastError();
info = TimeToString(TimeCurrent(), TIME_DATE | TIME_SECONDS) + " OrderClose(#" +
IntegerToString(OrderTicket()) + ", " + DoubleToString(OrderLots(), 2) +
", " + DoubleToString(Ask, Digits) + " (Ask), " + IntegerToString(UseSlippage) +
"): " + DescribeError(GetLastError());
Print(info);
if (GLE && IsFatalTradeError(GLE))
break;
Sleep(3000);
RefreshRates();
}
if (i < 10) {
Tickets[x] = 0;
TotalTrades--;
}
}
}
}
if (TotalTrades == 0) {
BreakEven = false;
Order_Type = "BuySell";
TheTime = Time[1];
Tickets[0] = 0;
Tickets[1] = 0;
}

return;
}

double PipPoint(string Currency) {
double CalcPoint = 0.0001;
int CalcDigits = (int)MarketInfo(Currency, MODE_DIGITS);

if (CalcDigits == 2 || CalcDigits == 3)
CalcPoint = 0.01;

return CalcPoint;
}

int GetSlippage(string Currency, int SlippagePips) {
int CalcSlippage = SlippagePips * 10;
int CalcDigits = (int)MarketInfo(Currency, MODE_DIGITS);

if (CalcDigits == 2 || CalcDigits == 4)
CalcSlippage = SlippagePips;

return CalcSlippage;
}

void OpenTrade(string Type) {
int i, GLE;
string info;
double TheSpread = MarketInfo(Symbol(), MODE_SPREAD) / 10.0;
double Lots = First_Trade_Lots;

if (!IsConnected()) {
Print("OpenTrade: " + TimeToString(TimeCurrent(), TIME_DATE | TIME_SECONDS) + " IsConnected() is false");
return;
}
if (IsTradeContextBusy()) {
Print("OpenTrade: " + TimeToString(TimeCurrent(), TIME_DATE | TIME_SECONDS) + " IsTradeContextBusy() is true");
return;
}

if(Digits==2 || Digits==4)
TheSpread = MarketInfo(Symbol(),MODE_SPREAD);

if (TheSpread > Max_Spread_Pips) {
Print("Spread too large, can't place trade");
return;
}

if (TotalTrades == 1)
Lots = Second_Trade_Lots;

if (Type == "Buy") {
for (i = 0; i < 10 && (Tickets[TotalTrades] = OrderSend(Symbol(), OP_BUY, Lots, Ask, UseSlippage, 0, 0,
"Buy Finch Trade: " + Symbol(), Magic, 0, clrGreen)) == -1; i++) {
GLE = GetLastError();
info = "OpenTrade: " + TimeToString(TimeCurrent(), TIME_DATE | TIME_SECONDS) + ": Buy OrderSend #"
+ IntegerToString(TotalTrades + 1) + ": " + DescribeError(GLE);
Print(info);
if (GLE && IsFatalTradeError(GLE))
return;
Sleep(3000);
RefreshRates();
}
if (i == 10)
return;

if(GetLastError()==4110) {BuysNotAllowed=true;return;}

if (OrderSelect(Tickets[TotalTrades], SELECT_BY_TICKET)) {
if (Stop_Loss_In_Pips > 0 && TotalTrades == 0)
Order_Stop = OrderOpenPrice() - (Stop_Loss_In_Pips * UsePoint);
PriceForSecond = OrderOpenPrice() - (Pips_To_Trade_2 * UsePoint);
}

TotalTrades++;
Order_Type="Buy";

SendAlert("New Trifecta Rollover Finch Buy Trade on the "+Symbol());
}
else if (Type == "Sell") {
for (i = 0; i < 10 && (Tickets[TotalTrades] = OrderSend(Symbol(), OP_SELL, Lots, Bid, UseSlippage, 0, 0,
"Sell Finch Trade: "+Symbol(), Magic, 0, clrRed)) == -1; i++) {
GLE = GetLastError();
info = "OpenTrade: " + TimeToString(TimeCurrent(), TIME_DATE | TIME_SECONDS) + ": Sell OrderSend #"
+ IntegerToString(TotalTrades + 1) + ": " + DescribeError(GLE);
Print(info);
if (GLE && IsFatalTradeError(GLE))
return;
Sleep(3000);
RefreshRates();
}
if (i == 10)
return;

if(GetLastError()==4111) {SellsNotAllowed=true;return;}

if (OrderSelect(Tickets[TotalTrades], SELECT_BY_TICKET)) {
if (Stop_Loss_In_Pips > 0 && TotalTrades == 0)
Order_Stop = OrderOpenPrice() + (Stop_Loss_In_Pips * UsePoint);
PriceForSecond = OrderOpenPrice() + (Pips_To_Trade_2 * UsePoint);
}

TotalTrades++;
Order_Type="Sell";

SendAlert("New Trifecta Rollover Finch Sell Trade on the "+Symbol());
}
return;
}

bool RSISellCheck(int Loc)
{
double RSIMain = iRSI(Symbol(),0,RSIPeriod,PRICE_CLOSE,Loc);
if(RSIMain < 50) return(false);
for(int x=Loc;x<=Loc+2;x++)
{
if(High[x]>High[Loc])return(false);
}
for(int y=Loc+4;y<(Loc+CandlesBack);y++)
{
if(High[y]>High[Loc]) break;
int s=y;
for(int z=y-2;z<=y+2;z++)
{
if(High[z]>High[y]){y++; break;}
}
if(s!=y){y--; continue;}
bool OB=false;
for(int k=Loc;k<=y;k++)
{
double RSIOB = iRSI(Symbol(),0,RSIPeriod,PRICE_CLOSE,k);
if(RSIOB>70) {OB=true; break;}
}
if(OB==false) continue;
double Mom1=iMomentum(Symbol(),0,MomentumPeriod,PRICE_CLOSE,Loc);
double Mom2=iMomentum(Symbol(),0,MomentumPeriod,PRICE_CLOSE,y);
if(Mom1>Mom2) continue;
LastKDS=y;
return(true);
}
return(false);
}
bool RSIBuyCheck(int Loc)
{
double RSIMain = iRSI(Symbol(),0,RSIPeriod,PRICE_CLOSE,Loc);
if(RSIMain > 50) return(false);
for(int x=Loc;x<=Loc+2;x++)
{
if(Low[x]<Low[Loc])return(false);
}
for(int y=Loc+4;y<(Loc+CandlesBack);y++)
{
if(Low[y]<Low[Loc]) break;
int s=y;
for(int z=y-2;z<=y+2;z++)
{
if(Low[z]<Low[y]){y++; break;}
}
if(s!=y){y--; continue;}
bool OB=false;
for(int k=Loc;k<=y;k++)
{
double RSIOB = iRSI(Symbol(),0,RSIPeriod,PRICE_CLOSE,k);
if(RSIOB<30) {OB=true; break;}
}
if(OB==false) continue;
double Mom1=iMomentum(Symbol(),0,MomentumPeriod,PRICE_CLOSE,Loc);
double Mom2=iMomentum(Symbol(),0,MomentumPeriod,PRICE_CLOSE,y);
if(Mom1<Mom2) continue;
LastKDB=y;
return(true);
}
return(false);
}
void SendAlert(string Message)
{
if(Mail_Alert) SendMail("New Rollover Finch Alert",Message);
if(PopUp_Alert) Alert(Message);
if(Sound_Alert) PlaySound("alert.wav");
if(SmartPhone_Notifications) SendNotification(Message);
return;
}

string DescribeError(int ErrorNum) {
return IntegerToString(ErrorNum) + "-" + ErrorDescription(ErrorNum);
}

bool IsFatalTradeError(int GLE) {
return GLE == ERR_INVALID_TRADE_PARAMETERS ||
GLE == ERR_NO_CONNECTION ||
GLE == ERR_MALFUNCTIONAL_TRADE ||
GLE == ERR_TRADE_TIMEOUT ||
GLE == ERR_INVALID_STOPS ||
GLE == ERR_TRADE_DISABLED ||
GLE == ERR_NOT_ENOUGH_MONEY ||
GLE == ERR_TRADE_NOT_ALLOWED ||
GLE == ERR_LONGS_NOT_ALLOWED ||
GLE == ERR_SHORTS_NOT_ALLOWED;
}

Top
#464784 - 03/12/17 15:03 Re: Z System result sharing? [Re: RTG]
Sphin Offline
Senior Member

Registered: 12/11/13
Posts: 415
Loc: Fuerth, DE
Happy coding! laugh

Top
#464793 - 03/13/17 03:34 Re: Z System result sharing? [Re: Sphin]
RTG Offline
Member

Registered: 02/23/14
Posts: 161
Going through the code, it does seems overly complex compared to zorro's built in functions.

Top
#465576 - 05/04/17 13:25 Re: Z System result sharing? [Re: RTG]
toc17 Offline
Guest

Registered: 01/24/17
Posts: 3
Loc: Madrid
Hi RTG,
Could you do the porting of the MT4 EA?

Top
#465624 - 05/06/17 04:03 Re: Z System result sharing? [Re: toc17]
RTG Offline
Member

Registered: 02/23/14
Posts: 161
No I didn't convert. I am running it directly through MT4.

Top
#466713 - 06/28/17 15:22 Re: Z System result sharing? [Re: RTG]
Caine1 Offline
Newbie

Registered: 04/14/17
Posts: 10
Hello RTG,

how is the startegy doing?
did you create a myfxbook page concerning this strategy?

Top
#466802 - 07/03/17 12:44 Re: Z System result sharing? [Re: Caine1]
JoFo Offline
Newbie

Registered: 07/03/17
Posts: 24
Loc: Bangkok
I traded the Z7 and Z 12 Systems live on Oanda Account for 4 Weeks on 10 different accounts.
so far I can say if you start 10 times Z7 and 10 times Z12 Systems even on same time you will get slightly different results. The number of trades will differ after a while and also sometimes the traded asset. The results also differ in a range up to 30 % in a month period.
it look like it depend on to much random ! if you get started with a more profitable system.

Z7 was a headache. Allways loosing money.

Z 12 was much better even when the results differ. Best single result was 35 % profit in one month. So far my Favorit.

i set up the Accounts on 2 Server. Keep in mind that also your server needs updates and sometimes must be restarted. Then you have to switch of your trading systems, closing your trades and restart after Update is done on your Server. So you will anyway have to stop and restart your systems every couple weeks.


If you setup a trading system for live trading:

Set timezone on your server on UTC !

Load up the newest Zorro Version on your server !

Add all necessary Assets to the AssetFix List by Download Script

Create Accounts.csv with your Account data

With Oanda you will have a primary account and can have up to 19 under accounts
create underaccountsV20 hedging enable ! After creating all underacounts you need you can create your V20 token on Oanda website for your Account.csv

Upload all t6 files from the Zorro download Site

start Download Script and choise ALL ASSETS

set Load M 1 Data on 2005-2017 and start by clicking.

after download start training. You can see if all Assets are in and all necessary datas are in the history folder.

If there was no problem and the test results are positive like expected you are ready for trading.

update and reboot your servers and you are ready for trading.


NOW SOME THINGS TO KEEP IN MIND

Never ever rename Z Systems !!!

Allways use a fresh OS System on the server and a fresh Zorro Installation

Never play around on the Z System

Never run a System with an Error message while training or/and when you start TRADE !

make sure you have AssetsFix and not Assetsfix in your Historyfiles


If everything is fine sit back relax and watch the systems trading


Edited by JoFo (07/03/17 16:41)

Top
#466945 - 07/10/17 12:24 Re: Z System result sharing? [Re: JoFo]
jmb Offline
Newbie

Registered: 03/11/15
Posts: 25
JoFo

This is a really good list of dos and don'ts. The one I fell foul of is
Quote:
Always use a fresh... Zorro Installation

My Z12 didn't do well until I did a complete uninstall and reinstall. Then I simply launched the system, and the results have been much better.

I'd add that it seems to be best to run the Z systems separately in their own discreet, separate subdirectories.


Edited by jmb (07/10/17 12:29)

Top
Page 5 of 6 < 1 2 3 4 5 6 >



Gamestudio download | chip programmers | Zorro platform | shop | resources | magazine | manual | support faq | bugs

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) 3dgamestudio.net