Please edit your post and
use the code button (Alt+S) when pasting code
Now im this far...
#include<Trade\Trade.mqh> #include <Trade\PositionInfo.mqh> CTrade trade; CPositionInfo m_position; void OnTick() { double Ask=NormalizeDouble(SymbolInfoDouble(_Symbol,SYMBOL_ASK),_Digits); MqlDateTime date; datetime date1= D'2019.26.02'; datetime date2= D'2019.26.03'; datetime date3= D'2019.26.04'; datetime date4= D'2019.26.05'; datetime date5= D'2019.26.06'; datetime date6= D'2019.26.08'; datetime date8= D'2019.05.03'; datetime date9= D'2019.05.04'; datetime date10= D'2019.05.05'; datetime date11= D'2019.05.06'; datetime date12= D'2019.05.08'; datetime now = TimeCurrent(); if((PositionsTotal()==0) && now == date1 || date2 || date3 || date4 || date5 || date6 ) { trade.Buy(0.10,NULL,Ask,0,0,NULL); } if((PositionsTotal()==1) && now == date11 || date12 || date10 || date9 || date8 ) { trade.PositionClose(1); } } //+------------------------------------------------------------------+
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hello Guys,
I want a algorithm which trades periods of time.
It should open a Trade on every 26th of a month except on January&Juli.
And close this Trade on every 5th Month of next.
with no Stoploss.
I came so far..
////////////////////////////////