First off let me say ANY help is greatly appreciated. I am not a coder, I modify just about every indicator and ea that I have. Keeps me busy so I am not watching every damn tick of the charts. I am more of a cut and paste coder, I do occasionally get a working indy or ea that works how I want. But My pile of trashed code is growing.
Right now I am working on a ea that will implement my thoughts into real live trading results, yep the holy grail. Probably grow old and die before I get it right, but I'll die tryin.
Anyway first up is a simple (yea right) piece of code from a ea that you have to set the digits of the broker manually. I thought with all the samples out there how hard could it be? Well after screwing around with 50 variations ( ok slight exageration), but 5 hrs worth, it still wont work or even come out error free.
I submit for you humor, my attempt along with the original code for some help before I take the keyboard and kill the dog.
Original code
Code: Select all
extern int AccDigits = 5;
int fpc()
{
if (AccDigits == 5) return (10);
if (AccDigits == 6) return (100);
return (1);
}
double PointEx()
{
if (AccDigits == 5) return (10*Point);
if (AccDigits == 6) return (100*Point);
return (Point);
}Code: Select all
// need to auto adjust for digits // ---------------------- s01
//extern int AccDigits = 5; // see above ^^^^^^^^^^^
//+-----------------------------------------------------------------------+
//| Auto Adjust for different digit criminals - put in after int section |
//+-----------------------------------------------------------------------+
//Adapt to x digit criminals
//------------- orig code was at bottom ----------------------------------
void init() // copied this from below to get rid of MarketInfo - initialization expected error
{
int AccDigits = MarketInfo, chart, digits; // added chart, digits; to get rid of error
int DIGITS = MarketInfo (chart, MODE_DIGITS); // changed symbol to chart to get rid of error
// will have to test to see if it works
int fpc() // used later down
{
if (AccDigits == 4) return (1); // added a01
if (AccDigits == 5) return (10);
if (AccDigits == 6) return (100); // for future criminal adjustments
if (AccDigits == 7) return (1000); // added s01 ^^^^^^^^^^^^^^^^^^^^^
return (1);
}
double PointEx()
{
if (AccDigits == 4) return (1*Point); // added s01
if (AccDigits == 5) return (10*Point);
if (AccDigits == 6) return (100*Point); // for future criminal adjustments
if (AccDigits == 7) return (1000*Point); // added s01 ^^^^^^^^^^^^^^^^^^^^^
return (Point);
}
}But I get a 'AcctDigits' - variable not defined error on only the lower section of the code, below the double PointEx(). and a unbalanced parentheses errror at the end, But that does not show up in the Empty4 editor or the SciTE editor as a problem?
Again help save a few lives, help a suffering soul out ...
Thanks again in advance ..... so1 / Steve