Gamestudio Links
Zorro Links
Newest Posts
folder management functions
by 7th_zorro. 04/16/24 13:19
lookback setting performance issue
by 7th_zorro. 04/16/24 03:08
zorro 64bit command line support
by 7th_zorro. 04/15/24 09:36
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:48
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:46
LPDIRECT3DCUBETEXTUR
E9

by Ayumi. 04/12/24 11:00
Sam Foster Sound | Experienced Game Composer for Hire
by titanicpiano14. 04/11/24 14:56
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (rki, Ayumi), 475 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
11honza11, ccorrea, sakolin, rajesh7827, juergen_wue
19045 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
AssetList(again) #478964
01/28/20 22:04
01/28/20 22:04
Joined: Jan 2020
Posts: 32
L
leohermoso Offline OP
Newbie
leohermoso  Offline OP
Newbie
L

Joined: Jan 2020
Posts: 32
I am struggling with something that supposed to be simple, the creation of my asset list.

I took advantage of
Quote
#define EXAMINE


inside the MT4/5 plugin to generate and check the list. Well even using the exact same values, zorro complains about MarginCost. In the asset list MarginCost is set to 0(zero)

Quote

2020.01.28 19:00:03.468 Zorro (EURUSD,H1) Examine XTIUSD Price 54.03000 Spread 0.11000
2020.01.28 19:00:03.468 Zorro (EURUSD,H1) XTIUSD Point 0.01000 Digits 2 PIP 0.01000
2020.01.28 19:00:03.468 Zorro (EURUSD,H1) XTIUSD LotMin 0.01 LotSize 100.00 LotAmount 1.00
2020.01.28 19:00:03.468 Zorro (EURUSD,H1) XTIUSD PipCost 0.01000 MarginCost 5.00


So my AssetList for pepperstone should be something like this:

Code
Name	Price	Spread	RollLong	RollShort	PIP	PIPCost	MarginCost	Leverage	LotAmount	Commission	Symbol
AUD/CAD	0,90919	0,00009	-2,21	-0,83	0,0001	0,076017	0	500	1000	0	AUD/CAD
AUD/JPY	76,06	0,002	2,27	-4,77	0,01	0,091612	0	500	1000	0	AUD/JPY
AUD/NZD	1,0442	0,00007	-1,75	-2,02	0,0001	0,065468	0	500	1000	0	AUD/NZD
AUD/USD	0,69974	0,00004	-2,62	-1,97	0,0001	0,1	0	500	1000	0	AUD/USD
AUS200	6747,9	3,8	-3,31	-1,69	0,1	0,006763	0	500	0,1	0	AUS200
CAD/JPY	83,67	0,016	2,94	-6,04	0,01	0,091612	0	500	1000	0	CAD/JPY
EUR/AUD	1,60037	0,00005	-11,45	6,68	0,0001	0,067628	0	500	1000	0	EUR/AUD
EUR/CAD	1,4549	0,00004	-11,86	6,55	0,0001	0,076017	0	500	1000	0	EUR/CAD
EUR/CHF	1,08651	0,00005	-1,15	-2,58	0,0001	0,102769	0	500	1000	0	EUR/CHF
EUR/GBP	0,8498	0,00007	-5,34	0,5	0,0001	0,13026	0	500	1000	0	EUR/GBP
EUR/JPY	121,71	0,003	-3,16	-1,05	0,01	0,091612	0	500	1000	0	EUR/JPY
EUR/NZD	1,67089	0,00015	-11,86	5,77	0,0001	0,065468	0	500	1000	0	EUR/NZD
EUR/USD	1,11967	0,00003	-8,57	4,46	0,0001	0,1	0	500	1000	0	EUR/USD
GBP/AUD	1,88347	0,00016	-8,52	0,13	0,0001	0,067628	0	500	1000	0	GBP/AUD
GBP/CAD	1,71224	0,00008	-9,6	0,63	0,0001	0,076017	0	500	1000	0	GBP/CAD
GBP/CHF	1,27868	0,00016	1,76	-8,64	0,0001	0,102769	0	500	1000	0	GBP/CHF
GBP/JPY	143,24	0,009	-0,14	-7,5	0,01	0,091612	0	500	1000	0	GBP/JPY
GBP/NZD	1,96645	0,00032	-8,94	-1,53	0,0001	0,065468	0	500	1000	0	GBP/NZD
GBP/USD	1,31775	0,00006	-6,79	-0,04	0,0001	0,1	0	500	1000	0	GBP/USD
GER30	13371,35	5	-2	-3	0,1	0,011022	0	500	0,1	0	GER30
JPN225	23761,5	20	-2,41	-2,59	0,1	0,009161	0	500	10	0	JPN225
NZD/CAD	0,87096	0,00019	-2,4	-0,45	0,0001	0,076017	0	500	1000	0	NZD/CAD
NZD/JPY	72,85	0,006	1,8	-4,46	0,01	0,091612	0	500	1000	0	NZD/JPY
NZD/USD	0,67025	0,00006	-2,14	-1,17	0,0001	0,1	0	500	1000	0	NZD/USD
UK100	7615,25	4	-3,15	-1,85	0,1	0,013026	0	500	0,1	0	UK100
USD/CAD	1,29943	0,00001	-2,9	-1,93	0,0001	0,076017	0	500	1000	0	USD/CAD
USD/CHF	0,97038	0,00005	4,56	-8,18	0,0001	0,102769	0	500	1000	0	USD/CHF
USD/JPY	108,7	0,004	2,92	-8,2	0,01	0,091612	0	500	1000	0	USD/JPY
XAG/USD	18,1	0,011	-1,41	0,47	0,01	0,5	0	500	50	0	XAG/USD
XAU/USD	1528,3	0,15	-10,85	4,57	0,01	0,01	0	500	1	0	XAU/USD



Yet, when I start zorro connecting to MT4 the asset.csv created on log folder comes with a complete nonsense Leverage Values and still zero for MarginCost

This is what I got.

Code
Name	Price	Spread	RollLong	RollShort	PIP	PIPCost	MarginCost	Leverage	LotAmount	Commission	Symbol
AUD/CAD	0,90919	0,00009	-2,21	-0,83	0,0001	0,076017	0	0,676	1000	0	AUD/CAD
AUD/JPY	76,06	0,002	2,27	-4,77	0,01	0,091612	0	0,676	1000	0	AUD/JPY
AUD/NZD	1,0442	0,00007	-1,75	-2,02	0,0001	0,065468	0	0,676	1000	0	AUD/NZD
AUD/USD	0,69974	0,00004	-2,62	-1,97	0,0001	0,1	0	0,676	1000	0	AUD/USD
AUS200	6747,9	3,8	-3,31	-1,69	0,1	0,006763	0	300	0,1	0	AUS200
CAD/JPY	83,67	0,016	2,94	-6,04	0,01	0,091612	0	0,76	1000	0	CAD/JPY
EUR/AUD	1,60037	0,00005	-11,45	6,68	0,0001	0,067628	0	1,102	1000	0	EUR/AUD
EUR/CAD	1,4549	0,00004	-11,86	6,55	0,0001	0,076017	0	1,102	1000	0	EUR/CAD
EUR/CHF	1,08651	0,00005	-1,15	-2,58	0,0001	0,102769	0	1,102	1000	0	EUR/CHF
EUR/GBP	0,8498	0,00007	-5,34	0,5	0,0001	0,13026	0	1,102	1000	0	EUR/GBP
EUR/JPY	121,71	0,003	-3,16	-1,05	0,01	0,091612	0	1,102	1000	0	EUR/JPY
EUR/NZD	1,67089	0,00015	-11,86	5,77	0,0001	0,065468	0	1,102	1000	0	EUR/NZD
EUR/USD	1,11967	0,00003	-8,57	4,46	0,0001	0,1	0	1,102	1000	0	EUR/USD
GBP/AUD	1,88347	0,00016	-8,52	0,13	0,0001	0,067628	0	1,303	1000	0	GBP/AUD
GBP/CAD	1,71224	0,00008	-9,6	0,63	0,0001	0,076017	0	1,303	1000	0	GBP/CAD
GBP/CHF	1,27868	0,00016	1,76	-8,64	0,0001	0,102769	0	1,303	1000	0	GBP/CHF
GBP/JPY	143,24	0,009	-0,14	-7,5	0,01	0,091612	0	1,303	1000	0	GBP/JPY
GBP/NZD	1,96645	0,00032	-8,94	-1,53	0,0001	0,065468	0	1,303	1000	0	GBP/NZD
GBP/USD	1,31775	0,00006	-6,79	-0,04	0,0001	0,1	0	1,303	1000	0	GBP/USD
GER30	13371,35	5	-2	-3	0,1	0,011022	0	300	0,1	0	GER30
JPN225	23761,5	20	-2,41	-2,59	0,1	0,009161	0	300	10	0	JPN225
NZD/CAD	0,87096	0,00019	-2,4	-0,45	0,0001	0,076017	0	0,655	1000	0	NZD/CAD
NZD/JPY	72,85	0,006	1,8	-4,46	0,01	0,091612	0	0,655	1000	0	NZD/JPY
NZD/USD	0,67025	0,00006	-2,14	-1,17	0,0001	0,1	0	0,655	1000	0	NZD/USD
UK100	7615,25	4	-3,15	-1,85	0,1	0,013026	0	300	0,1	0	UK100
USD/CAD	1,29943	0,00001	-2,9	-1,93	0,0001	0,076017	0	1	1000	0	USD/CAD
USD/CHF	0,97038	0,00005	4,56	-8,18	0,0001	0,102769	0	1	1000	0	USD/CHF
USD/JPY	108,7	0,004	2,92	-8,2	0,01	0,091612	0	1	1000	0	USD/JPY
XAG/USD	18,1	0,011	-1,41	0,47	0,01	0,5	0	17,489	50	0	XAG/USD
XAU/USD	1528,3	0,15	-10,85	4,57	0,01	0,01	0	1568,2	1	0	XAU/USD



How should I trade with a 0,676 leverage? Can you please guys, give me some clarification on this?

Best Regards.

Leo Hermoso

Re: AssetList(again) [Re: leohermoso] #478966
01/28/20 23:40
01/28/20 23:40
Joined: Jan 2020
Posts: 32
L
leohermoso Offline OP
Newbie
leohermoso  Offline OP
Newbie
L

Joined: Jan 2020
Posts: 32
I did a fix

Code
brokerCommand(SET_PATCH, 16 + 32);
Leverage = 500;

Re: AssetList(again) [Re: leohermoso] #478969
01/29/20 13:04
01/29/20 13:04
Joined: Jul 2000
Posts: 27,978
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,978
Frankfurt
That's not a real fix. Better fix either the leverage, or the margin cost in your asset list. If your broker API does not provide these parameters, or returns nonsense, you must get them from the broker's website.

Re: AssetList(again) [Re: jcl] #478973
01/29/20 14:36
01/29/20 14:36
Joined: Jan 2020
Posts: 32
L
leohermoso Offline OP
Newbie
leohermoso  Offline OP
Newbie
L

Joined: Jan 2020
Posts: 32
jcl, tks for your reply!

That's exactly what I did. I used Spotware API and created a small python program to create the asset list.

For those search the list for pepperstone here it is.

Now in order to completely ignore data from broker should I use

Code
brokerCommand(SET_PATCH, 16 + 32 + 64);


Tks again

Attached Files
AssetList.csv (5 downloads)
Re: AssetList(again) [Re: leohermoso] #478974
01/29/20 15:27
01/29/20 15:27
Joined: Jan 2020
Posts: 32
L
leohermoso Offline OP
Newbie
leohermoso  Offline OP
Newbie
L

Joined: Jan 2020
Posts: 32
Even using this

Code
			brokerCommand(SET_PATCH, 16 + 32 + 64);
			printf("%f\n",MarginCost);


I still get a warning

Warning 054: EURUSD MarginCost 22-> 1000!

and the printed value for MarginCost is the one loaded for the server.

So what's the trick to make this brokerCommand(SET_PATCH, 16 + 32 + 64); works?

Re: AssetList(again) [Re: leohermoso] #478975
01/29/20 16:16
01/29/20 16:16
Joined: Feb 2017
Posts: 1,724
Chicago
AndrewAMD Offline
Serious User
AndrewAMD  Offline
Serious User

Joined: Feb 2017
Posts: 1,724
Chicago
The broker command must be issued before you load the assets so that it does not override your asset list settings.

Re: AssetList(again) [Re: leohermoso] #478976
01/29/20 16:20
01/29/20 16:20
Joined: Jan 2020
Posts: 32
L
leohermoso Offline OP
Newbie
leohermoso  Offline OP
Newbie
L

Joined: Jan 2020
Posts: 32
Tks Andrew!

Code
function run()
{
	brokerCommand(SET_PATCH, 16 + 32 + 64);
	assetList("History\\AssetListSimpleFx.csv");
	
	LookBack = 1;
	BarPeriod = 1440;
   
       StartDate = NOW;
	asset("EURUSD");	
	
	Margin = 4;
	enterLong();		
		
	
}


Can you please point where is the error in the code?

tks

Re: AssetList(again) [Re: leohermoso] #478977
01/29/20 17:21
01/29/20 17:21
Joined: Jan 2020
Posts: 32
L
leohermoso Offline OP
Newbie
leohermoso  Offline OP
Newbie
L

Joined: Jan 2020
Posts: 32
This

brokerCommand(SET_PATCH, 16 + 32 + 64);

can be marked as a bug(MT5), or you must provide a functional example on the manual.

Using the command or not, seems to have the same effect.

I followed the instructions in the manual( that, in this case, is absent) and also sent an email to support using a paid ticket, but this does not work.

Super frustrating.

Attached Files
support opde.PNG (77 downloads)
Re: AssetList(again) [Re: leohermoso] #478978
01/29/20 22:09
01/29/20 22:09
Joined: Jan 2020
Posts: 32
L
leohermoso Offline OP
Newbie
leohermoso  Offline OP
Newbie
L

Joined: Jan 2020
Posts: 32
The major problem is not the broker supplying wrong values, but the EA making some crazy calculations. I did a small modification on the EA(MT5 bridge) and now I can get the correct values.

Code
            double dLotFactor = MarketInfo(Asset,MODE_MINLOT); // correction for different lot scale
            double dFactor = pointFactor(Asset); // correction for brokers with 5 digits
            double pipPosition = MarketInfo(Asset,MODE_DIGITS) - 1;
            string quotecur = StringSubstr(Asset,3);
            double price = MarketInfo(Asset,MODE_ASK);
            double pip =  pow(10,-pipPosition);
            double lotamount =  MarketInfo(Asset,MODE_LOTSIZE) * dLotFactor;
            double pipcost = lotamount * pip;
            double leverage = AccountInfoInteger(ACCOUNT_LEVERAGE);
            double margincost = (lotamount * price);
            if(StringLen(Asset) == 6)
              {

               if(StringCompare(quotecur,"USD") != 0)
                 {
                  string symboconvert = "USD" + quotecur;
                  double price2;
                  bool is_custom=false;

                  if(SymbolExist(symboconvert,is_custom))
                    {
                     price2 = MarketInfo("USD" + quotecur,MODE_ASK);
                     is_custom = true;
                    }
                  else
                     if(SymbolExist(quotecur + "USD",is_custom))
                       {
                        price2 = MarketInfo(quotecur + "USD",MODE_ASK);
                        is_custom = true;
                       }
                  if(is_custom)
                    {
                     pipcost = pipcost / price2;
                     margincost = margincost / price2;
                    }

                 }
              }
            margincost = margincost / leverage;
            double rollLong  = MarketInfo(Asset,MODE_SWAPLONG) * pipcost ;
            double rollShort = MarketInfo(Asset,MODE_SWAPSHORT)* pipcost  ;

            /////////

            double LotFactor = MarketInfo(Asset,MODE_MINLOT); // correction for different lot scale

            Factor = pointFactor(Asset); // correction for brokers with 5 digits
            arr[3] = PIP = pip;
            arr[4] = PIPCost = pipcost;
            arr[5] = LotAmount = lotamount;
            if(LotAmount == 0. && arr[0] > 0.)
               Print("Asset ",Asset," Lot ",MarketInfo(Asset,MODE_LOTSIZE)," Min ",LotFactor);
            arr[6] = margincost;
            arr[7] = rollLong;
            arr[8] = rollShort;

            arr[9] = iVolume(Asset,PERIOD_M15,0)/15.;
            ZorroRespond(cmd,arr);
            break;


Moderated by  Petra 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1