value of a point in base currency

 

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

 

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?

 
sanju:

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?

Ensuing... love to hear some nice English :).

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
 
Thanks Jan...I solved this using a condition if TimeCurrent()==Time[0] then execute EA. But I think I will have a problem if within the same second there are multiple ticks. So I guess yours is a more elegant solution. Thanks...Sanju