Okay, here's a breakdown of what the script appears to be doing, explained in plain language for someone who doesn't code.
The script is designed to automate trading based on time-of-day and, potentially, price channel indicators. Let's break down the process step-by-step:
-
Configuration Settings: The script begins by establishing a few settings that control how it operates. Think of it like setting the knobs and dials on a trading machine. These include:
PriceChannel_ChannelPeriod
: This tells the script how many past time periods (likely candlesticks on a price chart) to consider when calculating the price channel. A larger number smooths the channel, while a smaller one makes it more sensitive to price fluctuations.PriceChannel_Risk
: This affects how tightly the price channel narrows or widens. It probably influences the sensitivity of the channel to price movement.������_��_�����_�����
: This is probably the number of points (a small unit of price movement) to offset the stop-loss order from a calculated point.TP
: This likely refers to "Take Profit" and represents the number of points the script aims to gain on a trade before automatically closing it.
-
Calculating Price Channel (Potentially Incomplete): The script attempts to retrieve price channel values from a custom indicator named "PriceChannel_Stop_v6." It's trying to get both the upper and lower boundaries (the "channel") from this indicator. The script then prints to the log.
Note: There is an issue here because if the script can't get the price channels then it will not trade correctly, and the price channel calculations seem incomplete. Also, I do not know what time period the Price Channel indicator is being calculated on.
-
Time-Based Trading Logic: The core of the script's logic is based on the time of day:
- Evening Sell Order (at 23:45): If the current hour is 23 (11 PM) and the minute is after 45, and if there are no open orders, the script will attempt to place a "Sell" order. This essentially bets that the price of the traded asset will decrease.
- Midnight Close Order (at 00:00): If the current hour is 0 (midnight), the script will attempt to close any existing open orders. It tries to close the oldest order. This closes all existing orders.
In essence, the script is designed to automatically sell near the end of the day (23:45) and close the order at midnight. The price channel parameters might be used for calculations of trade parameters, but the calculation logic is currently commented out.
extern string Ìåòêà1="-= Ïàðàìåòðû PriceChannel_Stop_v6 =-";
extern int PriceChannel_ChannelPeriod=26; //Price Channel Period
extern double PriceChannel_Risk=0.1; //channel narrowing factor (0...0,5)
extern string Ìåòêà2="-= Ïàðàìåòðû ñàìîãî ýêñïåðòà =-";
extern int Îòñòóï_îò_òî÷êè_ñòîïà=20;
extern int TP=200;
double PCSU,PCSD,PCst;
int cbar=0;
int start()
{
RefreshRates();
/* PCSU=iCustom(Symbol(),PERIOD_M15,"PriceChannel_Stop_v6",PriceChannel_ChannelPeriod, PriceChannel_Risk, 1, 0, 0, 0, 1000, 0, 1);
if (PCSU==0) PCSU=iCustom(Symbol(),PERIOD_M15,"PriceChannel_Stop_v6",PriceChannel_ChannelPeriod, PriceChannel_Risk, 1, 0, 0, 0, 1000, 2, 1);
PCSD=iCustom(Symbol(),PERIOD_M15,"PriceChannel_Stop_v6",PriceChannel_ChannelPeriod, PriceChannel_Risk, 1, 0, 0, 0, 1000, 1, 1);
if (PCSD==0) PCSD=iCustom(Symbol(),PERIOD_M15,"PriceChannel_Stop_v6",PriceChannel_ChannelPeriod, PriceChannel_Risk, 1, 0, 0, 0, 1000, 3, 1);
Print(" Íèæíÿÿ=",PCSU," Âåðõíÿÿ=",PCSD);*/
if (Hour()==23 && Minute()>45){
Print("inter");
if (OrdersTotal()<1) OrderSend(Symbol(),OP_SELL,0.1,Bid,2,0,0,"-",0,0,Yellow);}
if (Hour()==0)
{
OrderSelect(0,SELECT_BY_POS,MODE_TRADES);
OrderClose(OrderTicket(),OrderLots(),Ask,2,Orange);
}
}
Comments