I do this:
/////////////////////////////////////////////////////////////////////////////////////////
// FUNCTIONS
/////////////////////////////////////////////////////////////////////////////////////////
color WingdingColor;
datetime WingdingTime;
double WingdingCode; // Wingdings font symbols used with Arrow objects.
// 233=long(up arrow), 217=long(up arrow)
// 234=short(down arrow), 218=short(down arrow)
double Price;
int ArrowSize=4; // Should be from 0 to 7.
int err;
//Wingding(Time[0],redbar0,159,OrangeRed,"redbar");
//void Wingding(datetime WingdingTime, double Price, double WingdingCode, color WingdingColor)
void Wingding(datetime ArrowTime, double Price, double ArrowCode, color ArrowColor, string ArrowAction)
{
int err;
string ArrowName = DoubleToStr(ArrowTime,0)+" VOOCHTEST "+ArrowAction;
if (ObjectFind(ArrowName) != -1) ObjectDelete(ArrowName);
if(!ObjectCreate(ArrowName, OBJ_ARROW, 0, ArrowTime, Price))
{
err=GetLastError();
//Print("error: can't create Arrow! code #",err," ",ErrorDescription(err));
Print("error: can't create Arrow! code #",err);
return;
}
else
{
ObjectSet(ArrowName, OBJPROP_ARROWCODE, ArrowCode);
ObjectSet(ArrowName, OBJPROP_COLOR , ArrowColor);
ObjectSet(ArrowName, OBJPROP_WIDTH , ArrowSize);
ObjectsRedraw();
}
}
/////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////
// EXPERT START FUNCTION
/////////////////////////////////////////////////////////////////////////////////////////
int start()
{
/////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////
// DRAW MY WINGDINGS
/////////////////////////////////////////////////////////////////////////////////////////
// 1). Look at historical orders
TotalTrades = HistoryTotal();
cnt=TotalTrades-10;
if(cnt<0) { cnt=0; }
for(cnt=cnt;cnt<TotalTrades;cnt++) {
OrderSelect(cnt, SELECT_BY_POS, MODE_HISTORY);
if ( (OrderSymbol()==Symbol()) && (OrderMagicNumber()==MagicNumber) ) {
if (OrderType()==0) {
// Here, we're going to look at the long orders only
if(OrderClosePrice()>OrderOpenPrice()) {
// It was a profitable long
Wingding(OrderCloseTime(),OrderClosePrice(),74,YellowGreen,"closedlong"); // Smiley Face
} else {
// It was an unprofitable long
Wingding(OrderCloseTime(),OrderClosePrice(),77,Tomato,"closedlong"); // Bomb
}
}
if (OrderType()==1) {
// Here, we're going to look at the short orders only
if(OrderClosePrice()<OrderOpenPrice()) {
// It was a profitable short
Wingding(OrderCloseTime(),OrderClosePrice(),74,Orange,"closedshort"); // Smiley Face
} else {
// It was an unprofitable short
Wingding(OrderCloseTime(),OrderClosePrice(),77,Tomato,"closedshort"); // Bomb
}
}
}
}
// 2). Then I want to look at my active orders:
TotalTrades = OrdersTotal();
for(cnt=0;cnt<TotalTrades;cnt++) {
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
if ( (OrderSymbol()==Symbol()) && (OrderMagicNumber()==MagicNumber) ) {
if (OrderType()==0) {
Wingding(OrderOpenTime(),OrderOpenPrice(),217,Lime,"long"); // Up Fractal OP_BUY
// Here, we're going to look at the long orders only
if(Bid<OrderOpenPrice()) {
// It was a profitable long
} else {
// It was an unprofitable long
}
}
if (OrderType()==1) {
Wingding(OrderOpenTime(),OrderOpenPrice(),218,Orange,"short"); // Down Fractal OP_SELL
// Here, we're going to look at the short orders only
if(Ask>OrderOpenPrice()) {
// It was a profitable short
} else {
// It was an unprofitable short
}
}
}
}
/////////////////////////////////////////////////////////////////////////////////////////
// END OF EXPERT START FUNCTION
/////////////////////////////////////////////////////////////////////////////////////////
} // end of start()
/////////////////////////////////////////////////////////////////////////////////////////
- Vooch
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 tried to just simply make an expert that just sends an order every 5 min and buys at the market, but its arrow is still not plotted. Thank you for your help!