ea_daytripper_01
Download scriptThis automated trading tool is designed to execute trades based on the direction of price movement over a specific period. It monitors the market live and follows a straightforward logic centered on identifying trends in the opening prices of consecutive candles.
Core Functionality
The script operates by continuously analyzing three sequential data points (the current candle and the two preceding it). Its primary objective is to determine if the price is moving in a consistent upward or downward direction.
Trend Detection Logic:
- Upward Trend: The system identifies a "rising" market if the opening prices of the last three candles are strictly increasing (each one higher than the previous).
- Downward Trend: The system identifies a "falling" market if the opening prices of the last three candles are strictly decreasing (each one lower than the previous).
Trade Execution Process
Once the script detects a trend, it performs the following actions:
- Safety Check: Before attempting any action, the tool first checks your account balance. If the available funds are insufficient to cover the required margin for a trade based on your chosen position size, the system will stop and notify you that there is not enough money to proceed.
- Position Management: Every time the script runs its check, it automatically closes any existing open order. This ensures that the system is always reacting to the most recent price data rather than holding onto old positions.
- Order Placement:
- If a rising trend is confirmed, the script will automatically open a "Buy" position at the current market price.
- If a falling trend is confirmed, the script will automatically open a "Sell" position at the current market price.
User Customization
The tool allows you to define two key parameters:
- Lot Size: The volume of the trade you wish to execute.
- Moving Average: A setting provided for technical calculation (though the core logic primarily focuses on the immediate sequence of opening prices).
/*-----------------------------+
| |
| Shared by www.Aptrafx.com |
| |
+------------------------------*/
//+-------------------+
//| 1MA Expert |
//+-------------------+
#property copyright "Ron Thompson"
#property link "http://www.lightpatch.com/forex"
// User Input
extern double Lots = 0.1;
extern double MovingAvg=10;
// Global scope
double prevTime=0;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//|------------------------------------------------------------------|
int init()
{
return(0);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
bool rising=false;
bool falling=false;
if(AccountFreeMargin()<(1000*Lots)) {Print("We have no money"); return(0);}
if (Open[2]<Open[1]<Open[0]) {rising=true; falling=false;}
if (Open[2]>Open[1]>Open[0]) {rising=true; falling=false;}
OrderClose(OrderTicket(),Lots,Ask,0,Red);
if (rising)
{
Print("DTBUY ",Ask);
OrderSend(Symbol(),OP_BUY,Lots,Ask,3,0,0,"1MA Buy",11123,0,White);
}
if (falling)
{
Print("DTSELL ",Bid);
OrderSend(Symbol(),OP_SELL,Lots,Bid,3,0,0,"1MA Sell",11321,0,Red);
}
return(0);
}
Profitability Reports
Expected payoff
Average expected payoff across the available backtests for each symbol.
Comments