Need help in writing Code to find the before price of the current BID/ASK price. - page 2

 

Fred,

Thanks for responding. It looks like you are correct and that I misspoke. For some reason I was under the impression that Indicators would restart on each tick regardless of where they are at, but that is apparently not true based on what I read in the first link you provided. I can only guess, but I must have made that incorrect assumption based on something suggestive that I read.

I agree with you that it seems like there is never enough time to read up on things and it makes for a nice diversion some times.

Anyway, thanks for correcting me. I hate to be distributing erroneous information. Also, this changes some of the assumptions that I have made about the workings of Indicators and will allow me to go back and fix some of my mistakes - so thanks for the help!

- Tovan

 

"something suggestive" Tovan...! this is a family forum!!! - LOL

hey - me, you and all of us are in the same ship, maybe diff cabins at times but all paths crossing on the deck when sun out AND trusting the good ship MT (err lolypop) will take us to never never land where all is FX heaven!

has been fun Tovan.

I see your perpendicular line stuff... seem to remember other posts u do on math stuff.

huumphf! I can just about do percentage calcs... sometimes!

Regards

 

Hi fbj & Tovan:


Good day. I am very confussing now. Can't understand the whole conversation by both of you. Could you guy please kindly do me a favor, explain it in plain english? Sorry for this inconvenient. Can i still use the program code which Tovan wrote in the forum? Thank you.


regards,

miki

 
miki308 wrote >>

Hi fbj & Tovan:

Good day. I am very confussing now. Can't understand the whole conversation by both of you. Could you guy please kindly do me a favor, explain it in plain english? Sorry for this inconvenient. Can i still use the program code which Tovan wrote in the forum? Thank you.

regards,

miki

Hi Miki,

Yes, the code advice is still good. The moral of the story is, if your EA takes too long to run through each tick then you can (and probably will) loose some ticks - especially when you're doing any order opening, deleting, or modifying. You just need to keep that in mind if it's important to you.

- Tovan

 

Hi Tovan:


Thanks for your reply. It mean i have to keep my opening, buying or modifying code short and neat or else i will miss some ticks? Do correct it if i am wrong. Thanks Tovan.


regards,

miki

 
miki308 wrote >>

Hi Tovan:

Thanks for your reply. It mean i have to keep my opening, buying or modifying code short and neat or else i will miss some ticks? Do correct it if i am wrong. Thanks Tovan.

regards,

miki

Hi Miki,

Actually, the biggest delay is typically in the transaction with the broker and there's nothing you can do about that. How much delay depends on the traffic level. Sometimes the order will fail and it can take quite a while for the server to time out. That's one of the realities that separates back testing from forward test on a live server. You need to think about things like this as you write your EA if it is sensitive to holes in the data.

- Tovan

 

Hi Tovan:


Thanks for the superb information and advice. I will keep this in mind. :). Will try to figure out how to minimize the risk.


Have a great day ahead.


regards,

miki

 
ggekko:

Tovan's solution is great.

Here is a little sample for an EA:

Cheers
double tick_now, tick_prev=0.0;

int start()
   {

   tick_now=Bid;

   if(tick_now>tick_prev)
      {
      // ... calculations, order execution, etc.
      }

   tick_prev=tick_now;

   }

I am a beginner, and need help too,


What is tick_prev=0.0, why 0.0?

will (tick_now<tick_prev) work?

How do I get both previous Bid and Ask price?

Reason: