Jerommeke007
Jerommeke007
Jerommeke007
Added topic Buy/Sell after first hour of trading
Hi All, Im rather new here and I want to create a simple system where I look at the high and low of the first 1 hour candle at a start time (in this case 9.00).  If after this first 1 hour the rate goes above the high, than sell. If it goes
verenafreire
verenafreire 2023.02.22
If it helps, Chat GPT did as follows: void OnCalculate(const int rates_total, const int prev_calculated, const datetime &time[], const double &open[], const double &high[], const double &low[], const double &close[], const long &tick_volume[], const long &volume[], const int &spread[])
{ // Determine a hora de abertura do mercado datetime market_open = (TimeCurrent() / 86400) * 86400 + 3600; // Arredonda para o início do dia e adiciona 1 hora // Determine o preço máximo e mínimo na primeira hora de negociação do dia double max_price = 0.0; double min_price = 0.0; int hour = Hour(market_open); for(int i=0; i max_price || max_price == 0.0) max_price = high[i]; if(low[i] < min_price || min_price == 0.0) min_price = low[i]; } // Desenhe as linhas horizontais na tela ObjectCreate("MaxPriceLine", OBJ_HLINE, 0, 0, max_price); ObjectSet("MaxPriceLine", OBJPROP_COLOR, Lime); ObjectSet("MaxPriceLine", OBJPROP_STYLE, STYLE_SOLID); ObjectCreate("MinPriceLine", OBJ_HLINE, 0, 0, min_price); ObjectSet("MinPriceLine", OBJPROP_COLOR, Red); ObjectSet("MinPriceLine", OBJPROP_STYLE, STYLE_SOLID);
}
Jerommeke007
Added topic Buy/Sell after first 1 hour of trading
Hi All, Im rather new here and I want to create a simple system where I look at the high and low of the first 1 hour candle at a start time (in this case 9.00).  If after this first 1 hour the rate goes above the high, than sell. If it goes
Jerommeke007
Registered at MQL5.community