Which do you want, Base Currency or Deposit Currency?
For deposit currency
pipValue = MarketInfo(Symbol(), MODE_TICKVALUE) * OrderLots();
Thanks..this helps. I have one more issue. I want my EA to execute only at the start of a bar and not during the ensuing ticks within the bar. Any idea how I can implement this?
Let me elaborate. At the open of a bar, i want to look at preceding 5 bars and if my condition is met i want to enter a trade. now the EA runs at every tick of the current bar and at each tick the my condition is met as the preceding 5 bars are now fixed. As a reuslt, the EA will repeat the trade decision during each iteration within the current bar.
Is there a clean way to solve this problem?
Thanks..this helps. I have one more issue. I want my EA to execute only at the start of a bar and not during the ensuing ticks within the bar. Any idea how I can implement this?
Let me elaborate. At the open of a bar, i want to look at preceding 5 bars and if my condition is met i want to enter a trade. now the EA runs at every tick of the current bar and at each tick the my condition is met as the preceding 5 bars are now fixed. As a reuslt, the EA will repeat the trade decision during each iteration within the current bar.
Is there a clean way to solve this problem?
Sanju, the way I like to do this is as follows:
int BarsCount = 0; int start() { if (Bars > BarsCount) { //your code to be executed only once per bar goes here BarsCount = Bars; } return(0); }Define a global variable BarsCount. The integer Bars stores the number of bars in the current chart. Once a new bar is added on the chart, your code is executed but then you set BarsCount = Bars, so it will be executed again only when a new bar appears. BarsCount is initially set to 0, so your code is executed the very first time you load the indicator.
Jan
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi, I am trying to calculate the value of a point in the deposit currency so I can dynamically calculate trading lots such as to not exceed my risk beyond a predefined level based on my stop loss for a given trade. Can anyone help me with this info?
Thanks,
Sanju