MnQInvestmentDevelopment/MnQInvestment/00_StrategyswithSimon/DerBotDesZorns.mq5

93 lines
2.7 KiB
MQL5
Raw Permalink Normal View History

2025-05-30 15:08:44 +02:00
#include <trade/trade.mqh>
CTrade trade;
#property copyright "Copyright 2023, M & Q Investment Group"
#property link "https://www.mql5.com"
#property version "1.00"
input double TPBuy = 0.00001;
input double SLBuy = 0.00001;
input double TPSell = 0.00001;
input double SLSell = 0.00001;
input double TPAll = 0.0001;
input double SLAll = 0.0001;
input double TPSLDiff = 0.00001;
input double DifferenceToOpenBuy = 0.00001;
input double DifferenceToOpenSell = 0.00001;
input double DifferenceToOpenAll = 0.00001;
input double LotSize = 100;
input double MinimumCandleSize = 0.001;
void OnTick()
{
datetime GCurrenttime = TimeCurrent();
int CandleNumber = Bars(_Symbol,_Period);
bool NewCandleAppeared;
NewCandleAppeared = CheckfornewCandle(CandleNumber,GCurrenttime);
if (NewCandleAppeared && PositionsTotal() < 1)
{
double OpeningPriceLastCandle = iOpen(_Symbol,_Period,1);
double ClosingPriceLastCandle = iClose(_Symbol,_Period,1);
datetime Expirytime = TimeCurrent() + 120;
//GREEN TO RED CANDLE SELLSTOP
if ( MinimumCandleSize * -1 > OpeningPriceLastCandle - ClosingPriceLastCandle)
{
double TriggerpriceBuy = NormalizeDouble(OpeningPriceLastCandle - DifferenceToOpenAll,_Digits);
double TPBuyOrder = NormalizeDouble(TriggerpriceBuy + TPAll,_Digits);
double SLBuyOrder = NormalizeDouble(TriggerpriceBuy - SLAll,_Digits);
trade.BuyLimit(LotSize, TriggerpriceBuy, _Symbol, SLBuyOrder, TPBuyOrder, ORDER_TIME_SPECIFIED, Expirytime);
}
//RED TO GREEN CANDLE BUYSTOP
if ( MinimumCandleSize < OpeningPriceLastCandle - ClosingPriceLastCandle)
{
double TriggerpriceSell = NormalizeDouble(OpeningPriceLastCandle + DifferenceToOpenAll,_Digits);
double TPSellOrder = NormalizeDouble(TriggerpriceSell - TPAll,_Digits);
double SLSellOrder = NormalizeDouble(TriggerpriceSell + SLAll,_Digits);
trade.SellLimit(LotSize, TriggerpriceSell, _Symbol, SLSellOrder, TPSellOrder, ORDER_TIME_SPECIFIED, Expirytime);
}
}
// DISPLAY OF DATA DURING TRADE
double accountbalance = AccountInfoDouble(ACCOUNT_BALANCE);
double accountprofit = AccountInfoDouble(ACCOUNT_PROFIT);
double accountequity = AccountInfoDouble(ACCOUNT_EQUITY);
Comment("\nServertime: ", TimeCurrent(),
"\nCurrenttime: ",TimeLocal(),
"\nProfit: ", accountprofit,
"\nEquity: ", accountequity,
"\nBalance: ", accountbalance);
}