MnQInvestmentDevelopment/MnQInvestment/00_StrategyswithSimon/DerSteinDerWeißen.mq5

83 lines
3.8 KiB
MQL5
Raw Permalink Normal View History

2025-05-30 15:08:44 +02:00
<EFBFBD><EFBFBD>#property copyright "Copyright 2023, M & Q Investment Group"
#property link "https://www.mql5.com"
#property version "1.00"
bool CheckfornewCandle (int CandleNumber)
{
static int LastCandleNumber;
bool IsNewCandle= false;
if (CandleNumber>LastCandleNumber)
{
IsNewCandle = true;
LastCandleNumber = CandleNumber;
Print("New Candle",
"\nLastOpenTime: ",iTime(_Symbol,PERIOD_CURRENT,1),
"\nLastOpen: ",iOpen(_Symbol,PERIOD_CURRENT,1),
"\nLastClose: ",iClose(_Symbol,PERIOD_CURRENT,1));
}
return IsNewCandle;
}
void OnTick()
{
int CandleNumber = Bars(_Symbol,_Period);
bool NewCandleAppeared;
NewCandleAppeared = CheckfornewCandle(CandleNumber);
if (NewCandleAppeared)
{
}
}
void OnTimer()
{
// create array for price data
MqlRates Priceinformation[];
//sort the array from the current candle downwards
ArraySetAsSeries(Priceinformation,true);
//fill the array with price data
int copied = CopyRates(_Symbol,PERIOD_M1,0,1440,Priceinformation);
double Pricedifference[];
int PriceinformationSize = ArraySize(Priceinformation);
ArrayResize(Pricedifference,PriceinformationSize,0);
for (int i = 0; i < PriceinformationSize - 1; i ++)
{
Pricedifference[i] = Priceinformation[i].close - Priceinformation[i+1].close;
}
Print("------------------------------------------",
"\n 2. Last Price: ", NormalizeDouble(Priceinformation[1].close,5));
Print("Last Difference: ", NormalizeDouble(Pricedifference[0],5));
Print("Last Price: ", NormalizeDouble(Priceinformation[0].close,5));
}