DQADJ = 0
You need to define the size of an Array or use ArrayResize
So something Llke this or have I missed something?
DIGITS = MarketInfo(Symbol(),MODE_DIGITS);
DQADJ = DQ_ADJUST [ DIGITS ];
DQADJ = 0
You need to define the size of an Array or use ArrayResize
Do this . . .
int DQ_ADJUST[7] = { 0, 0, 1, 10, 1, 10, 100 };
I have been looking and learning and have found a way to start developing this mm system, granted I am not a coder by any stretch on the imagination.
...
Any help would be great
Cheers
Beno
There is a basic mistake throughout KellyxExperiment.mq4 which I think needs to be fixed before you go any further. In many of the functions you have a function name and variable within the function with exactly the same name and type. How the compiler is handling this is a mystery.
Typically functions and variables use different cases so you always know what you are dealing with. I am not sure what the current flavour of the month is, but if you use uppercase starts for the functions and lower case starts for the variables that would be fine. Some coding style Nazis insist that you write things in particular ways; I think the choice is more down to what you are comfortable with, especially on a one man project.
Here is my edit of one of your functions ...
int Trades(int ordType){ int tradeCount = 0; for(int i=0; i<OrdersHistoryTotal(); i++){ if( !OrderSelect(i, SELECT_BY_POS, MODE_HISTORY) ) continue; // select check if( OrderType() != ordType ) continue; // order type check if( IsSkip( OrderSymbol(), OrderMagicNumber(), OrderComment(), OrderOpenTime(), OrderCloseTime()) ) continue; tradeCount++; } return( tradeCount ); }
stdlib GBPUSD,Daily: loaded successfully
GBPUSD,Daily: GBPUSD 0 1.981721.98131.98290
GBPUSD,Daily: OrderSend error 4051
GBPUSD,Daily: invalid lots amount for OrderSend function
Tester: stop loss #1 at 1.98695 (1.98697 / 1.98722)
GBPUSD,Daily: GBPUSD 0.01 1.98692 1.9865 1.98810
GBPUSD,Daily: Risk by Optimal f : 0.00 lot (SL : 100pips, Fractional)
GBPUSD,Daily: Fractional Kelly (0.25) : 0.00%
GBPUSD,Daily: Optimal f (Kelly) : 0.00%
GBPUSD,Daily: Profit / Loss Ratio : 0.00
GBPUSD,Daily: Average Loss : 0.00 USD
GBPUSD,Daily: Average Win : 0.00 USD
GBPUSD,Daily: Trades : 0 (Total) / 0 (buy) / 0 (sell)
The Lot Size seems to be switching between 00, 10 so I suspect that has something to do with the Array is that correct?
DQADJ = 0
You need to define the size of an Array or use ArrayResize
Sorry, but you are incorrect. There is no need to define the array size when you do an initialization of an array. The OP's code is correct.
See K & R second edition page 86 or
MQL4 Reference | Basics | Variables | Initialization of variables.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I have been looking and learning and have found a way to start developing this mm system, granted I am not a coder by any stretch on the imagination.
I have attached a very simple EA just using a Daily Pivot nothing elaborate in an attempt to try and get the Kelly Lot Size going.
I would appreciate a few new sets of eyes looking over the code as I have a zero divide in the mm system I have added Print() to try and isolate it but can’t seem to find where I have gone wrong.
when the EA starts you will have a 0.00 lot size and that will go increase and decrease depending on how many wins or losses you have and the amount you win or lose.
So I have tried to say if KellyLot < MinLot the use the minimum lots allowed by the broker.
//--- check min, max Lot size
if(Kellylot<lot_min) Kellylot = lot_min;
if(Kellylot>lot_max) Kellylot=lot_max;
//---
Any help would be great
Cheers
Beno