#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 Red
extern int MAPeriod = 3;
extern int MAShift = 1;
extern double PointsShift=4.0;
double buffer[];
int init()
{
SetIndexBuffer(0, buffer);
return(0);
}
int start()
{
int limit;
int counted_bars=IndicatorCounted();
if(counted_bars<0) return(-1);
if(counted_bars>0) counted_bars--;
limit=Bars-counted_bars;
for(int i=0; i<limit; i++)
buffer[i] = iMA(NULL,0,MAPeriod,MAShift,MODE_SMA,PRICE_HIGH,i)+PointsShift*Point;
return(0);
}
I'm interested in system programming :)
Doc
Doc
glad i could help :)
what about that programming for a system? what exactly do you need?
RoBiK
I appreciate your imput.
Doc
Still interested in helping, we are having a hard time getting the system to work?
Regards
Doc
What I would like is a system that Sells when the price crosses above the moving average listed earlier
I run this on a 1 minute chart and look for the close of the previous bar to be below the mov and then the price to move above
Take profit at 2 to 3 pips profit.
Then the oppiste for a buy
buy when the price crosses below the moving average listed earlier
The moving average is of the low shifted down 3 to 4 pips.
Take profit at 2 to 3 pips profit.
Stoploss at 15 pips on both sides.
Dont do more that one buy per bar.
If you have any questions let me know
Doc
What I would like is a system that Sells when the price crosses above the moving average listed earlier
I run this on a 1 minute chart and look for the close of the previous bar to be below the mov and then the price to move above
Take profit at 2 to 3 pips profit.
Then the oppiste for a buy
buy when the price crosses below the moving average listed earlier
The moving average is of the low shifted down 3 to 4 pips.
Take profit at 2 to 3 pips profit.
Stoploss at 15 pips on both sides.
Dont do more that one buy per bar.
If you have any questions let me know
Doc
Here it is:
extern double Lots = 1;
extern int MAPeriod = 3;
extern int MAShift = 1;
extern double PointsShift=4.0;
extern int MAMethod = 1;
extern int SL = 15;
extern int TP = 5;
datetime lastTime;
datetime lastTrade;
double highMA;
double lowMA;
double previousHighMA;
double previousLowMA;
int init()
{
lastTime = Time[1];
lastTrade = Time[1];
highMA = ma(PRICE_HIGH);
lowMA = ma(PRICE_LOW);
}
int start()
{
int cnt, ticket, total;
if (Time[0] > lastTime)
{
previousHighMA = highMA;
previousLowMA = lowMA;
highMA = ma(PRICE_HIGH);
lowMA = ma(PRICE_LOW);
lastTime = Time[0];
}
total=OrdersTotal();
if(total<1 && lastTrade < Time[0])
{
if (Close[1] > previousLowMA && Close[0] < lowMA)
{
lastTrade = Time[0];
ticket = OrderSend(Symbol(), OP_BUY, Lots, Ask, 0, Bid - SL * Point, Bid + TP * Point, NULL, 0, 0, Green);
if(ticket>0)
{
if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)) Print("BUY order opened : ",OrderOpenPrice());
}
else Print("Error opening BUY order : ",GetLastError());
}
if (Close[1] < previousHighMA && Close[0] > highMA)
{
lastTrade = Time[0];
ticket = OrderSend(Symbol(), OP_SELL, Lots, Bid, 0, Ask + SL * Point, Ask - TP * Point, NULL, 0, 0, Red);
if(ticket>0)
{
if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)) Print("SELL order opened : ",OrderOpenPrice());
}
else Print("Error opening SELL order : ",GetLastError());
}
}
return(0);
}
double ma(int appliedPrice)
{
int ps;
if (appliedPrice == PRICE_HIGH)
{
ps = PointsShift;
}
else
{
ps = -PointsShift;
}
return (iMA(NULL, 0, MAPeriod, MAShift, MAMethod, appliedPrice, 0) + ps * Point);
}
Basicly it is a mean reversion strategy. I'm afraid it won't work as you expect... at least not in such a short time frame. The shorter the timeframe the higher must be the profit/loss ratio to cover the bid/ask spread expences.
Also instead of using fixed distance from average high/low i would probably choose some flexible method, such as bollinger bands or standard deviation channel. Also a moving average filter or directional movement filter could help in trending conditions.
Anyway... try it, maybe you come with some new ideas :)
Try theese parameters:
EURUSD 5 Minutes resolution
SL = 30
TP = 25
MAPeriod = 10
PointShift = 4
RoBiK
extern double PointsShift=2.0;
Can we exchange email addresses?
Where you located RobiK
HEre is was I have for the buy sell signals, seems to work but I can't get the exits to work
CrossUp = Close > (iMA(NULL,0,3,1,MODE_SMA,PRICE_HIGH,0)+2*Point)
&& Close[1] < (iMA(NULL,0,3,2,MODE_SMA,PRICE_HIGH,0)+2*Point);
CrossDown = Close < (iMA(NULL,0,3,1,MODE_SMA,PRICE_LOW,0)-2*Point)
&& Close[1] > (iMA(NULL,0,3,2,MODE_SMA,PRICE_LOW,0)-2*Point);
total = OrdersTotal();
if(total<1)
{
if(CrossUp)
{ OrderSend(Symbol(),OP_SELL,MyLots,Bid,2,MySellStop,MySellProfit,"3-20",007,0,Red);
SetIndexArrow(0,234);
PlaySound("alert.wav");
return(0);
}
if(CrossDown)
{ OrderSend(Symbol(),OP_BUY,MyLots,Ask,2,MyBuyStop,MyBuyProfit,"3-20",007,0,Yellow);
SetIndexArrow(0,233);
PlaySound("alert.wav");
return(0);
}
return(0);
Doc
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
How do I create this as a custom formula
TC = iMA(NULL,0,3,1,MODE_SMA,PRICE_HIGH,0)+4*Point;
PS Is there any one that is interested in providing programing for a system.