You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I've never met this bug:
int init()
{
start();
return(0);
}
int start()
{
int testarr[30];
for(int i=0;i<30;i++)testarr=i;
for(i=0;i<30;i++)Print(i," = ",testarr);
return(0);
}
2008.11.15 14:51:41 test3 GBPJPY,H1: 29 = 29
2008.11.15 14:51:41 test3 GBPJPY,H1: 28 = 28
2008.11.15 14:51:41 test3 GBPJPY,H1: 27 = 27
2008.11.15 14:51:41 test3 GBPJPY,H1: 26 = 26
2008.11.15 14:51:41 test3 GBPJPY,H1: 25 = 25
2008.11.15 14:51:41 test3 GBPJPY,H1: 24 = 24
2008.11.15 14:51:41 test3 GBPJPY,H1: 23 = 23
2008.11.15 14:51:41 test3 GBPJPY,H1: 22 = 22
2008.11.15 14:51:41 test3 GBPJPY,H1: 21 = 21
2008.11.15 14:51:41 test3 GBPJPY,H1: 20 = 20
2008.11.15 14:51:41 test3 GBPJPY,H1: 19 = 19
2008.11.15 14:51:41 test3 GBPJPY,H1: 18 = 18
2008.11.15 14:51:41 test3 GBPJPY,H1: 17 = 17
2008.11.15 14:51:41 test3 GBPJPY,H1: 16 = 16
2008.11.15 14:51:41 test3 GBPJPY,H1: 15 = 15
2008.11.15 14:51:41 test3 GBPJPY,H1: 14 = 14
2008.11.15 14:51:41 test3 GBPJPY,H1: 13 = 13
2008.11.15 14:51:41 test3 GBPJPY,H1: 12 = 12
2008.11.15 14:51:41 test3 GBPJPY,H1: 11 = 11
2008.11.15 14:51:41 test3 GBPJPY,H1: 10 = 10
2008.11.15 14:51:41 test3 GBPJPY,H1: 9 = 9
2008.11.15 14:51:41 test3 GBPJPY,H1: 8 = 8
2008.11.15 14:51:41 test3 GBPJPY,H1: 7 = 7
2008.11.15 14:51:41 test3 GBPJPY,H1: 6 = 6
2008.11.15 14:51:41 test3 GBPJPY,H1: 5 = 5
2008.11.15 14:51:41 test3 GBPJPY,H1: 4 = 4
2008.11.15 14:51:41 test3 GBPJPY,H1: 3 = 3
2008.11.15 14:51:41 test3 GBPJPY,H1: 2 = 2
2008.11.15 14:51:41 test3 GBPJPY,H1: 1 = 1
2008.11.15 14:51:41 test3 GBPJPY,H1: 0 = 0
Most random number generators are pretty straight forward to code, you can write one in MT4. The Mersenne twister is one of the best, see Mersenne twister - Wikipedia, the free encyclopedia for details.
Another article that describes a number of RNGs is CodeProject: .NET random number generators and distributions. Free source code and programming help The code is in C#, which is similar to C or MQL4.
Store Order History into Array
Hi Guys
I am trying to write a function that looks at the historical trades
for a particular currency pair and stores thier lot sizes into an Array.
If the order is a profit trade it stores the lot size as positive number
and if it is loss, then it is stored as negative value. For example
if last three trades for EUR/USD are as below,
trade number proft/loss lotsize
1 loss 1
2 profit 2
3 loss 2
then the array should store values as below
Array1 = {-1,2,-2}
for some reason, it does not work. I might be missing something or my logic may
be entirely wrong. I thought of running it past you guys. Any help is
much appreciated. Thank you.
void OrderHistory()
{
int Array1[];// = {1000,1000,1000,1000,1000,1000,1000,1000};
int i=1;
int histotal = OrdersHistoryTotal();
//Print("History : ", OrdersHistoryTotal());
if (histotal > 0)
{
for(int cnt=histotal;cnt>0;cnt--) // retrieve closed orders counting from the last.
{
if(OrderSelect(cnt,SELECT_BY_POS,MODE_HISTORY))
{
if(OrderSymbol()==Symbol() && OrderMagicNumber() == 12345)
{
if(OrderProfit() <= 0) // latest order close was a loss
{
Array1 = -(OrderLots());
i++;
continue;
// Print("Array:", Array1);
}
if(OrderProfit() > 0) // latest order close was a Win
{
Array1 = OrderLots();
i++;
// Print("ArrayP", Array1);
continue;
}
}
}
}
int j=i;
ArrayResize(Array1,i);
Print ("Array Size", ArraySize (Array1));
for(int cont=1; cont<=i;cont++)
{
Print ("Arrrrray_cont", cont);
Print ("Array Value: ", Array1[cont]);
}
}
}
Array function
The calculated values of all symbol's volatility are placed in an array volatility[26].As symbols are string they are indexed and placed in an array idx[25]. but I do not know how to create a two dimensional array with volatility value as 1st element and index value as 2nd element so that I can sort the first dimension of the array in a descending mode.
any help will be much appreciated.