Guys, I have a problem (BTW, this problem occour several times in several several conditions)...
Look my code..
Several positions are opened when, actually, I'd like was opened only one position. How to fix this problem?
PS: This code was wrote in "OnTick"
I am assuming that you are testing that on an account that allows hedging.
Add something like this
int totalForSymbol=0; for (int i=0; i<PositionsTotal(); i++) if (PositionGetSymbol(i)==_Symbol) totalForSymbol++;
at the beginning of that code and the before each Trade.PositionOpen() check if(totalForSymbol<1)
I am assuming that you are testing that on an account that allows hedging.
Add something like
this
at the beginning of that code and the before each Trade.PositionOpen() check if(totalForSymbol<1)
Yeah! I already using this ideia!!! xDDD
But, and I want open two positions? Three? Four? Five...
So, this is not a good filter...
I'm thinking about to create a filter with time. Something like this: "If a position was opened in the last 1 min, no open more none position."
In this case, I need to create a chronometer that start with 00:00:00 and start the acconting with the opening of a new position and every time that new position is opened, so the chronometer restart the accounting from zero.
This a good ideia!! I think...
So, in this case, I need to create a chronometer and I don't how do it... kkkk
Yeah! I already using this ideia!!! xDDD
But, and I want open two positions? Three? Four? Five...
So, this is not a good filter...
I'm thinking about to create a filter with time. Something like this: "If a position was opened in the last 1 min, no open more none position."
In this case, I need to create a chronometer that start with 00:00:00 and start the acconting with the opening of a new position and every time that new position is opened, so the chronometer restart the accounting from zero.
This a good ideia!! I think...
So, in this case, I need to create a chronometer and I don't how do it... kkkk
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Guys, I have a problem (BTW, this problem occour several times in several several conditions)...
Look my code..
Several positions are opened when, actually, I'd like was opened only one position. How to fix this problem?
PS: This code was wrote in "OnTick"