Welcome to Forex-TSD!, one of the largest Forex forums worldwide, where you will be able to find the most complete and reliable Forex information imaginable.
From the list below, select the forum that you want to visit and register to post, as many times you want. It’s absolutely free. Click here for registering on Forex-TSD.
Exclusive Forum
The Exclusive Forum is the only paid section. Once you subscribe, you will get free access to real cutting-edge Trading Systems (automated and not), Indicators, Signals, Articles, etc., that will help and guide you, in ways that you could only imagine, with your Forex trading.
Elite Section
Get access to private discussions, specialized support, indicators and trading systems reported every week.
Advanced Elite Section
For professional traders, trading system developers and any other member who may need to use and/or convert, the most cutting-edge exclusive indicators and trading systems for MT4 and MT5.
what is the code for
buy area = daily open price + (20% * daily open)
sell area = daily open price - (20% * daily open)
Here we go,
Code:
//--open value for the current day, set the 0 to 1 for the previous day open
double DO=iOpen(NULL, PERIOD_D1, 0);
if(Bid>=(DO+DO*0.2))
OrderSend(set the criteria for BUY);
if(Bid<=(DO-DO*0.2))
OrderSend(set the criteria for SELL);
// --- Main Function call -----------------------------------------------------
int start()
{
double high = iHigh(Symbol(),PERIOD_D1,0);
double low = iLow(Symbol(),PERIOD_D1,0);
double Range =(high-low); if(Digits<4) Range=Range*100; else Range=Range*10000;
double GetPer = Percent*(Range/100);
// ----------------------------------------------------------------------------
Comment ("High : ",high,", Low : ",low,", Range : ",Range,"\n",Percent,"% : ",GetPer);
return(0);
}
// --- End of Main Function ---------------------------------------------------
I'm currently trading with a martingale EA which will open max 4 levels of orders. I just think of a hedging strategy that may reduce the risk of using this EA. Below is a description of my strategy:
1. The hedging EA will monitor the drawdown of the opening orders. If the total floating losses is greater than a pre-determined amount, it will trigger the EA to open a hedged order in opposite to the opening orders.
2. The lot size of the hedged order is calculated based on a multiple (user can set the multiple) of the lot size of the last opening order (e.g. if the lot size of the last level order is 1.6 and the multiple is set at 2, then the hedged order will be open with lot size at 3.2.
3. When the hedged order returned to its opening level, the hedged order will be closed automatically.
4. When the overall basket (the opening orders + the hedged order) reaches a pre-determined net profit amount, all orders will be closed.
I wonder if some good programmer can code this hedging EA for me. I think it will be very useful for other martingale EA as well. Thanks a lot!
whoa..
thanks guys..
how about buy stop and sell stop?
just change "BUY" over there?
just want 2 positions only for 1 pairs, not more than that..
sorry, still newbie..
// These buffers are not plotted, just used to determine arrows
SetIndexBuffer (2,Buffer1);
SetIndexBuffer (3,Buffer2);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+ int start()
{
int i, counted_bars=IndicatorCounted();
double MA5,MA34;
int limit=Bars-counted_bars;
Print(" print limit = ", limit);
if(counted_bars>0) limit++; <----can someone explain to me what it means ?
// Main line for(i=0; i<limit; i++) <----can someone explain to me what it means ?
{
MA5=iMA(NULL,0,Fast.MA.Period,0,MODE_SMA,PRICE_MED IAN,i);
MA34=iMA(NULL,0,Slow.MA.Period,0,MODE_SMA,PRICE_ME DIAN,i);
Buffer1[i]=MA5-MA34;
}
// Signal line
for(i=0; i<limit; i++) <----can someone explain to me what it means ?
{ Buffer2[i]=iMAOnArray(Buffer1,Bars,Signal.period,0,MODE_LWMA ,i);
} <----can someone explain to me what it means ?
// Arrows
for(i=0; i<limit; i++)
{
if(Buffer1[i] > Buffer2[i] && Buffer1[i-1] < Buffer2[i-1])
b2[i] = High[i]+10*Point;
if(Buffer1[i] < Buffer2[i] && Buffer1[i-1] > Buffer2[i-1])
b3[i] = Low[i]-10*Point; <----can someone explain to me what it means ?
}
if(counted_bars>0) limit++;[/u][/b] <----can someone explain to me what it means ?
// Main line for(i=0; i<limit; i++) <----can someone explain to me what it means ?
// Signal line
for(i=0; i<limit; i++) <----can someone explain to me what it means ?
{ Buffer2[i]=iMAOnArray(Buffer1,Bars,Signal.period,0,MODE_LWMA ,i);
} <----can someone explain to me what it means ?
// Arrows
for(i=0; i<limit; i++)
{
if(Buffer1[i] > Buffer2[i] && Buffer1[i-1] < Buffer2[i-1])
b2[i] = High[i]+10*Point;
if(Buffer1[i] < Buffer2[i] && Buffer1[i-1] > Buffer2[i-1])
b3[i] = Low[i]-10*Point; <----can someone explain to me what it means ?
Thanks guys =^_^=
It's easy.
When you start your indi, Bars=1000 (for example) and counted_bars=0. So limit=1000 and your indi calculates all 1000 bars. After this counted_bars=1000, and every new tick indi calculates only last (zero) bar. When next bar comes, limit=1 and indi recalculates two last bars.
b3[i] = Low[i]-10*Point; - it's just a line 10 points lower then bar's minimum.
// These buffers are not plotted, just used to determine arrows
SetIndexBuffer (2,Buffer1);
SetIndexBuffer (3,Buffer2);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+ int start()
{
int i, counted_bars=IndicatorCounted();
double MA5,MA34;
int limit=Bars-counted_bars;
Print(" print limit = ", limit);
if(counted_bars>0) limit++; <----can someone explain to me what it means ?
// Main line for(i=0; i<limit; i++) <----can someone explain to me what it means ?
{
MA5=iMA(NULL,0,Fast.MA.Period,0,MODE_SMA,PRICE_MED IAN,i);
MA34=iMA(NULL,0,Slow.MA.Period,0,MODE_SMA,PRICE_ME DIAN,i);
Buffer1[i]=MA5-MA34;
}
// Signal line
for(i=0; i<limit; i++) <----can someone explain to me what it means ?
{ Buffer2[i]=iMAOnArray(Buffer1,Bars,Signal.period,0,MODE_LWMA ,i);
} <----can someone explain to me what it means ?
// Arrows
for(i=0; i<limit; i++)
{
if(Buffer1[i] > Buffer2[i] && Buffer1[i-1] < Buffer2[i-1])
b2[i] = High[i]+10*Point;
if(Buffer1[i] < Buffer2[i] && Buffer1[i-1] > Buffer2[i-1])
b3[i] = Low[i]-10*Point; <----can someone explain to me what it means ?
}
//----
return(0);
}
Thanks guys =^_^=
If you want to use this indicator in an ea you can use the icustom() function to access it. you dont really need to understand any of the code of the indicator, just the data that it spits out. At least thats the easy way to do it.
If you want to use this indicator in an ea you can use the icustom() function to access it. you dont really need to understand any of the code of the indicator, just the data that it spits out. At least thats the easy way to do it.
Meaning to say, use the function icustom() in the EA to recall the indis ? how should the coding to be written in the EA ? can give me some guide ?