I have had a look at the Fib coding.
The way the robot works is this:
_______________________________________________________________
Re the closing trades thingy, people may remember that I took this robot off my live account a couple of weeks ago, after several dozen trades opened and closed in rapid succession, making a tiny loss each time. Collectively, that was several hundred pips down the drain.
With sam2fx reporting trades closing at a loss, it looks as though there is a bug in the code, so I am going to look again.
For now, nobody should be trading this robot live. For that, you need to look at Ronald Raygun's ea. Ok, mine has extra features but they are useless if the basics do not work properly.
The way the robot works is this:
- It spots that PSAR has changed direction and sets a global variable on the platform that tells it so start looking at the other trade filters.
- On subsequent ticks, the robot finds the gv and goes into the trade filter function. This function uses the construct TradeAllowed = CheckFilters(type); where 'type' is either long or short.
- CheckFilters(type) is a function that examines the filters one by one. In 'naked' AshFx, these are just Stoch, AO and AC. Other filters are examined if their inputs are set to 'true'.
- If any of the filters give an inappropriate reading, then the robot exits the function and sets TradeAllowed to false, which in turn tells it not to send the trade.
- If all the filters meet the robot's requirements, it exits the function with TradeAllowed set to true, which in turn tells it to send the trade.
From my work on Friday, I could see the Stoch, AO and AC filters passing but did not have time to examine any further.
I intended releasing the robot with fibs turned off by default, but they were being used on the demo - I had not noticed and discovered this when I looked a few minutes ago.
Make sure UseFibs is set to false on each instance of the robot people are demoing, unless your robot is happily placing trades; it looks as though it is the fibs thingy killing all trading, but we need to see next week.
Here is the code; see if anybody else can spot errors.
Inserted Code
bool CheckFilters(int type) { // Returns true if all the trade filters line up, else returns false // Check Volume if (UseVolume) { if (Volume[1] < Volume[2]) return(false); if (Volume[2] < Volume[3]) return(false); }//if (UseVolume) //Current Fibo band if (UseFibs) { GetCurrentFibBand(); if (FibBandHigh == -1 || FibBandLow == -1) return(false); }//if (UseFibs) //Set up MA's if (UseMA) { double FastMaPrice = iMA(NULL,0, FastMA,0,MODE_EMA,PRICE_CLOSE,0); double SlowMaPrice = iMA(NULL,0, SlowMA,0,MODE_SMA,PRICE_CLOSE,0); }//if (UseMA) //Check for long trade if (type == 0) { //Stoch if (UseStochastic) { double StochVal = ReadStochastic(); if (StochVal > StochOverBought) return(false); }//if (UseStochastic) //AO if (iAO(NULL,0,0) < iAO(NULL,0,1)) return(false); if (iAO(NULL,0,1) < iAO(NULL,0,2)) return(false); //AC if (iAC(NULL,0,0) < iAC(NULL,0,1)) return(false); if (iAC(NULL,0,1) < iAC(NULL,0,2)) return(false); // Up candle if (Close[1] < Open[1]) return(false); //MA if (UseMA) { if (FastMaPrice <= SlowMaPrice) return(false); }//if (UseMA) //Fibs. if (UseFibs) { if (FibBandHigh - Ask < MinPipsToNextLevel * Poin) return(false); }//if (UseFibs) }//if (type == 0) //Check for short trade if (type == 1) { //Stoch if (UseStochastic) { StochVal = ReadStochastic(); if (StochVal < StochOverSold) return(false); }//if (UseStochastic) //AO if (iAO(NULL,0,0) > iAO(NULL,0,1)) return(false); if (iAO(NULL,0,1) > iAO(NULL,0,2)) return(false); //AC if (iAC(NULL,0,0) > iAC(NULL,0,1)) return(false); // Down candle if (Close[1] > Open[1]) return(false); //MA if (UseMA) { if (FastMaPrice >= SlowMaPrice) return(false); }//if (UseMA) //Fibs. if (UseFibs) { if (Bid - FibBandLow < MinPipsToNextLevel * Poin) return(false); }//if (UseFibs) }//if (type == 1) //Got this far, so everything lines up return(true); }// End bool CheckFilters(int type)
_______________________________________________________________
Re the closing trades thingy, people may remember that I took this robot off my live account a couple of weeks ago, after several dozen trades opened and closed in rapid succession, making a tiny loss each time. Collectively, that was several hundred pips down the drain.
With sam2fx reporting trades closing at a loss, it looks as though there is a bug in the code, so I am going to look again.
For now, nobody should be trading this robot live. For that, you need to look at Ronald Raygun's ea. Ok, mine has extra features but they are useless if the basics do not work properly.