MQL4 - automated forex trading   /  

Forum

value of a point in base currency

Back to topics list To post a new topic, please log in or register

avatar
7
sanju 2007.09.16 23:29 

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

article

Problems of Technical Analysis Revisited

At present, technical analysis along with the fundamental one is the most important method to analyze stock market. Being one of the predicting methods of stock market pricing dynamics, the technical analysis has a large amount of disadvantages that cast some doubt on its practical applicability.


avatar
2462
phy 2007.09.16 23:45 

Which do you want, Base Currency or Deposit Currency?

For deposit currency

pipValue = MarketInfo(Symbol(), MODE_TICKVALUE) * OrderLots();


avatar
7
sanju 2007.09.17 19:12 

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?


avatar
123
janklimo 2007.09.17 21:51 
sanju wrote:

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



avatar
7
sanju 2007.09.17 21:51 
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
Back to topics list  

To add comments, please log in or register