[WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. - page 1125
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
There is a very interesting function for marking found variables. Press Ctrl+F, enter a variable name, tick the "Bookmark" and "Mark found" boxes. Then press the "Find all" button. To remove it, click the "Remove All" button.
And a double click takes you to a code snippet))) Just what I need, thanks)
I don't understand, which object needs to be double clicked on?
Trade once a day!!! How would this be done?
There is such a variant, which does not work when turned on (when turned off, trades are opened, but not once a day). As the basis for the code taken somewhere on these open spaces. Please correct this code.
extern bool WaitForNewDay = true; //----- switch to check every day
bool Trade=true; //--flag for next trade (set to true)
datetime bt,tm; //---- variables for day check function
....
int init()
{
if(WaitForNewDay) {Trade=false;} //---- if the mode is enabled, then in the initialization the flag is assigned to prohibit trade
return(0);
}
.....
int start()
{
if(WaitForNewDay) CheckForNewDay();
...
if(CalculateCurrentOrders(Symbol())==0 && Trade) //----- check open orders and check the flag
{
CheckForOpen(); //---------open order
if (WaitForNewDay) {Trade=false;} //----------- if same-day mode is enabled, then trade is disabled after the trade
return;
}
}
//--------------function to check one day
void CheckForNewDay()
{
tm=iTime(Symbol(),PERIOD_D1,0); //--------- check current day
if (bt!=tm) {bt=tm; trade=true;} //---------- if the old date does not match the current date, the old date is assigned to the current date value and the flag is granted permission to trade
}
And where does it have a button???
(trades open when switched off, but not once a day)
And how is this?
The error is in the original post, I'll fix it now. When WaitForNewDay = false, the Expert Advisor works without limit - 1 trade per day.
Error in the original post, I'll fix it now. When WaitForNewDay = false, the EA works without limit - 1 trade per day.
The code is wrong. First of all, if the start() function is of int type, it should return an integer value. The return you have here is returned only by a condition. And if the condition is not fulfilled, what should the start() function return to the terminal?
Further, you are too complicated to check - better to do as follows: we create a counter of orders, open and closed today. If the number of orders closed today is greater than zero, then you do not trade. Otherwise, you are allowed to trade.
How do I see the tick chart, with all the history?
Write an indicator that will draw ticks after launching. Option 2 - write each tick to a text document and subsequently retrieve the entire tick history at the right moment.
Write an indicator that will draw the ticks after launching. Option 2 - write off each tick into a text document and subsequently retrieve the entire tick history at the right moment.