Price Data Components
Orders Execution
Indicators Used
Miscellaneous
0
Views
0
Downloads
0
Favorites
chinkoucross
extern double Lots = 0.1;
extern int StopLoss = 15;
extern int TrailingStop = 15;
extern int TakeProfit = 300;
extern int Slippage = 3;
double Points, lastTradeTime = 0;
void printDebug()
{
}
bool newDay()
{
if (TimeDay(Time[0])!=TimeDay(Time[1]))
return (true);
else
return (false);
}
int init ()
{
Points = MarketInfo (Symbol(), MODE_POINT);
return(0);
}
int deinit()
{
return(0);
}
int start()
{
double lot=Lots, stopLoss=StopLoss, trailingStop=TrailingStop, takeProfit=TakeProfit;
string symbol = "";
int i, orderType, orderTicket, total;
int openTrades = 0, openOrders = 0, openBuy = 0, openSell = 0;
int openBuyLimit = 0, openSellLimit = 0, openBuyStop = 0, openSellStop = 0;
int minutesBetweenTrades = 30;
double stopLossMult = 1, trailingStopMult = 1, takeProfitMult = 10;
double chinkouSpanLong, chinkouSpanShort;
datetime orderCloseTime;
int numOfLosingTradesToday = 0;
bool trailingRules = false ,debug = true;
if (newDay())
numOfLosingTradesToday = 0;
total = OrdersTotal();
for(i=0;i<total;i++)
{
OrderSelect(i,SELECT_BY_POS);
symbol = OrderSymbol();
orderType = OrderType();
orderTicket = OrderTicket();
/* 0-OP_BUY 1-OP_SELL 2-OP_BUYLIMIT 3-OP_BUYSTOP 4-OP_SELLLIMIT 5-OP_SELLSTOP */
if (symbol == Symbol()
&& orderType == 0)
{
openBuy++;
openTrades++;
}
if (symbol == Symbol()
&& orderType == 1)
{
openSell++;
openTrades++;
}
if (symbol == Symbol()
&& orderType == 2)
{
openBuyLimit++;
openTrades++;
}
if (symbol == Symbol()
&& orderType == 3)
{
openBuyStop++;
openTrades++;
}
if (symbol == Symbol()
&& orderType == 4)
{
openSellLimit++;
openTrades++;
}
if (symbol == Symbol()
&& orderType == 5)
{
openSellStop++;
openTrades++;
}
}
stopLoss=StopLoss*Point;
trailingStop=TrailingStop*Point;
takeProfit=TakeProfit*Point;
if (iClose(NULL, 0, 27) > iIchimoku(NULL, 0, 9, 26, 52, MODE_CHINKOUSPAN, 27) &&
iClose(NULL, 0, 28) <= iIchimoku(NULL, 0, 9, 26, 52, MODE_CHINKOUSPAN, 28))
{
chinkouSpanLong = true;
chinkouSpanShort = false;
}
if (iClose(NULL, 0, 27) < iIchimoku(NULL, 0, 9, 26, 52, MODE_CHINKOUSPAN, 27) &&
iClose(NULL, 0, 28) >= iIchimoku(NULL, 0, 9, 26, 52, MODE_CHINKOUSPAN, 28))
{
chinkouSpanLong = false;
chinkouSpanShort = true;
}
//Print ("CHINKOUSPAN 1) = " + iCustom(NULL, 0, "Ichimoku", 9, 26, 52, 4, 27));
//Print ("CHINKOUSPAN 2) = " + iCustom(NULL, 0, "Ichimoku", 9, 26, 52, 4, 28));
// Long entry rules
if
(
chinkouSpanLong &&
openBuy == 0 &&
openTrades == 0
)
{
Alert("CHINKOUCross for "+Symbol()+" on the "+Period()+" minute chart.");
}
// Short entry rules
if
(
chinkouSpanShort &&
openSell == 0 &&
openTrades == 0
)
{
Alert("CHINKOUCross for "+Symbol()+" on the "+Period()+" minute chart.");
}
return(0);
}
Comments
Markdown Formatting Guide
# H1
## H2
### H3
**bold text**
*italicized text*
[title](https://www.example.com)

`code`
```
code block
```
> blockquote
- Item 1
- Item 2
1. First item
2. Second item
---