![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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 have a data table, 2 dimensional, stored into a 2 dimensional array. I want to do some manipulation, such as sorting according to any column from that data table.
The ArraySort() function, in the instruction, can sort arrays on its 1st dimension. I don't see how that can works for me.
Any suggestions about data table sorting on MetaTrader?Every standard array sorting function I have ever heard of only sorts the first dimension. You may have to create your own. Or check out advanced C++ sorting algorythms on the web if you have not tried that allready.
Multiple EAs using Multiple Accounts
Hello,
I am new to Metatrader4 (and fx trading). What I would like to know is whether it is possible to test multiple EAs using multiple demo accounts of the same deposit size using the same currency pair on the one Metatrader4 platform?
For example I have five different EAs one allocated each to their own demo account of $1000 each using only GBPUSD on the one platform so that I can compare their performance over a period of time.
When I tried to do this in my StrategyBuilder - Metatrader - Demo either I found that the EA installation from one account was carried forward when I logged into the next account or when disabled one EA on the carried forward account to install another EA the EA on the first account disabled.
I do realise that it is possible to have a different EA for different currency pairs in the same account but this does not enable me to compare the performance of various EAs to the same currency pair.
Is backtesting then my course of action. If so please provide some information on how to get started.
Many Thanks for any assistance.
Freedom FX
Freedom FX,
Your active account is managed by whatever EAs are running in your terminal, so I don't think you can do what you are asking. You can however install multipkle copies of MT4 on your computer and run one of them for each of your demo accounts.
Ryanklefas,
Here is code that enters pending orders based on the current price action (bid/ask)
My Question:
I am wanting this to enter the pending orders off the Daily pivot and not the current price.
Can you point me to some examples where I can try and figure this out or is there some high low pivot logic I can incorporate into this code then point to that as the reference instead of the bid/ask?
Thanks for your assistance.
}
OrderSend(Symbol(),
OP_BUYSTOP,
lots,
Ask+open_long*Point, // Spread included
slippage,
Bid+(open_long-stop_long)*Point,
Bid+(open_long+take_profit)*Point,
NULL,
magic,
0,
FireBrick);
OrderSend(Symbol(),
OP_SELLSTOP,
lots,
Bid-open_short*Point,
slippage,
Ask-(open_short-stop_short)*Point,
Ask-(open_short+take_profit)*Point,
NULL,
magic,
0,
FireBrick);
clear_to_send = false;
}
noLagMACD
Can anyone tell me what is wrong with this piece of code. I am trying to incorporate a noLagMACD into Makegrid193. It compiles and runs, just doesn't change the settings of myWantLongs and myWantShorts at all, so there are no orders generated.
if(UseMACDNoLag)
{
int limit=Bars;
myWantLongs = false;
myWantShorts = false;
for(i=0; i<limit; i++)
{
FastEMABuffer=iMA(NULL,PERIOD_M5,emaFast,0,MODE_EMA,PRICE_CLOSE,i);
SlowEMABuffer=iMA(NULL,PERIOD_M5,emaSlow,0,MODE_EMA,PRICE_CLOSE,i);
}
for(i=0; i<limit; i++)
{
EMA=iMAOnArray(FastEMABuffer,0,emaFast,0,MODE_EMA,i);
ZeroLagEMAp=FastEMABuffer+FastEMABuffer-EMA;
EMA=iMAOnArray(SlowEMABuffer,0,emaSlow,0,MODE_EMA,i);
ZeroLagEMAq=SlowEMABuffer+SlowEMABuffer-EMA;
MACDBuffer=ZeroLagEMAp - ZeroLagEMAq;
}
double tester1, tester2, tester3;
tester1 = MACDBuffer[0];
tester2 = MACDBuffer[1];
tester3 = MACDBuffer[2];
if( (tester1 > 0.0) && (tester2 <= 0.0) ) // cross up
{
CloseAllPendingOrders();
if(CloseOpenPositions == true)
{
ClosePendingOrdersAndPositions();
}
if(wantLongs==true)
{
myWantLongs = true;
}
myWantShorts = false;
}
if( (tester1 = 0.0) ) // cross down
{
CloseAllPendingOrders();
if(CloseOpenPositions == true)
{
ClosePendingOrdersAndPositions();
}
if(wantShorts==true)
{
myWantShorts = true;
}
myWantLongs = false;
}
if( (tester1 > 0.0) && (tester2 > 0.0) && (tester3 > 0.0) && (wantLongs==true) ) // is well above zero
{
myWantLongs = true;
}
if( (tester1 < 0.0) && (tester2 < 0.0) && (tester3 < 0.0) && (wantShorts==true) ) // is well below zero
{
myWantShorts = true;
}
}
Don't worry
I discovered Time[] and iComplex and that mess I posted before became this.
if(UseMACDNoLag)
{
if(newbar != Time[0])
{
newbar=Time[0];
myWantLongs = false;
myWantShorts = false;
MACD_Main = iCustom(NULL, 0, "ZeroLag MACD", FastEMA, SlowEMA, SignalEMA, 0, 1);
if(MACD_Main > 0)
{
if(!MACDup)
{
if(CloseOpenPositions == true)
{
ClosePendingOrdersAndPositions();
}
else
{
CloseAllPendingOrders();
}
}
MACDup = true;
myWantShorts = false;
if(wantLongs==true)
{
myWantLongs = true;
}
}
if(MACD_Main < 0)
{
if(MACDup)
{
if(CloseOpenPositions == true)
{
ClosePendingOrdersAndPositions();
}
else
{
CloseAllPendingOrders();
}
}
MACDup = false;
myWantLongs = false;
if(wantShorts==true)
{
myWantShorts = true;
}
}
}
}
This is so much fun!!! If I get good results with this EA I'll post it.
Ryanklefas,
Here is code that enters pending orders based on the current price action (bid/ask)
My Question:
I am wanting this to enter the pending orders off the Daily pivot and not the current price.
Can you point me to some examples where I can try and figure this out or is there some high low pivot logic I can incorporate into this code then point to that as the reference instead of the bid/ask?
Thanks for your assistance.
}
OrderSend(Symbol(),
OP_BUYSTOP,
lots,
Ask+open_long*Point, // Spread included
slippage,
Bid+(open_long-stop_long)*Point,
Bid+(open_long+take_profit)*Point,
NULL,
magic,
0,
FireBrick);
OrderSend(Symbol(),
OP_SELLSTOP,
lots,
Bid-open_short*Point,
slippage,
Ask-(open_short-stop_short)*Point,
Ask-(open_short+take_profit)*Point,
NULL,
magic,
0,
FireBrick);
clear_to_send = false;
}
[/code]Each pviot point is a price value. And, a pending order must be placed at a certain price, at which it will become active. Therefore, when placing a pending order, set its entry price to a pivot level of your choice. Then set your stoplosses and takeprofits in relation to the entry price for the order
[code]
}
OrderSend(Symbol(),
OP_BUYSTOP,
lots,
pivotLevelGoesHere,
slippage,
pivotLevelGoesHere-(stop_long*Point),
pivotLevelGoesHere+(take_profit*Point),
NULL,
magic,
0,
FireBrick);
OrderSend(Symbol(),
OP_SELLSTOP,
lots,
anotherPivotLevelGoesHere,
slippage,
anotherPivotLevelGoesHere+(stop_short*Point),
anotherPivotLevelGoesHere-(take_profit*Point),
NULL,
magic,
0,
FireBrick);
clear_to_send = false;
}
That is what I thought so thank you for confirming that. I am not sure of the logic to create a pivot so that s where I will head next.
Thanks for your time.
elliot wave indicator
does anyone have an elliot wave indicator that draws and labels each wave? i have seen the ew oscillator and another one but they dont do the trick. maybe even a harmonic pattern indicator that draws and labels each pattern???
That is what I thought so thank you for confirming that. I am not sure of the logic to create a pivot so that s where I will head next. Thanks for your time.
There are plenty of indicators that draw pivots which you can use, at the following link. Or you can even calculate the pivots yourself in your EA, but I think that would be stupid.![](https://c.mql5.com/forextsd/smiles/regular_smile.png)
http://www.forexmt4.com/
does anyone have an elliot wave indicator that draws and labels each wave? i have seen the ew oscillator and another one but they dont do the trick. maybe even a harmonic pattern indicator that draws and labels each pattern???
Maybe the above link can help you too?