I agree with Alain, if you have written the code yourself, there is no need to be embarrassed. You are trying and that is the main thing, you may even get some pointers for improving your code.
The people that should be embarrassed are those that copy and paste code and try to pass it as their own.
I exceed the 64,000 character limit when I try and post it. I can't find any posting guidelines. What's the best way to tackle this?
Regards Brian
I exceed the 64,000 character limit when I try and post it. I can't find any posting guidelines. What's the best way to tackle this?
Regards Brian
Attach your file.
- 2010.02.25
- MetaQuotes Software Corp.
- www.mql5.com
- SSMagnitude =((SwingHighLineV-SwingLowLineV)/ATR4)*10000;Code assumes 5 digit broker, non-JPY pair. Divide by _Point, add pip's.
if(trend==up)EntryAdjust=EntryLineV+(Spread1/10000)+0.00010;
if(trend==down)EntryAdjust=EntryLineV-0.00010;
if(trend==up)StopAdjust=LossLineV-0.0002;
if(trend==down)StopAdjust=LossLineV+(Spread1/10000)-0.0002;
StopLossPipsL=MathAbs((StopAdjust-EntryAdjust)*10000);You are not adjusting SL, TP, and slippage for 4/5 digit brokers/JPY pairs.double pip = (_Symbol,"JPY") < 0 ? 0.01 : 0.0001;
int pip_digits = (int)MathLog10(pip/_Point);
int slippage = 3 * int(pip / _Point); - ATR4Real=NormalizeDouble(iATR(NULL,ATR4Timeframe,ATR1Period,0)/Point,0);Why are you including a partially formed bar in your ATR?
ATR24=NormalizeDouble(iATR(NULL,ATR24Timeframe,ATR1Period,0)/Point,0) - Do NOT use NormalizeDouble, EVER. For ANY Reason. It's a kludge, don't use it. It's use is always wrong
- SL/TP (stops) need to be normalized to tick size (not Point.) (On 5Digit Broker Stops are only allowed to be placed on full pip values. How to find out in mql? - MQL4 forum) and abide by the limits Requirements and Limitations in Making Trades - Appendixes - MQL4 Tutorial and that requires understanding floating point equality Can price != price ? - MQL4 forum
- Open price for pending orders need to be adjusted. On Currencies, Point == TickSize, so you will get the same answer, but it won't work on Metals. So do it right: Trailing Bar Entry EA - MQL4 forum or Bid/Ask: (No Need) to use NormalizeDouble in OrderSend - MQL4 forum
- Lot size must also be adjusted to a multiple of LotStep. If that is not a power of 1/10 then NormalizeDouble is wrong. Do it right.
- ATR4Real=ATR4Real/1000000;No idea what that represents. Definitely not correct 4/5 JPY/other code.
- if(TradePair == "GBPUSD" || TradePair == "EURUSD" ||TradePair == "AUDUSD" ||TradePair == "NZDUSD") OandaUnits = (DollarsRisked *10000)/ StopLoss * AusPrice;Do you really think your indicator will run on other pairs? And #1
if(TradePair == "USDCHF" ||TradePair == "USDCAD") OandaUnits = (DollarsRisked *10000)/ StopLoss * AusPrice * CurrentPrice;
if(TradePair == "USDJPY" ) OandaUnits = (DollarsRisked *100)/ StopLoss * AusPrice * CurrentPrice;- You place the stop where it needs to be - where the reason for the trade is no longer valid. E.g. trading a support bounce the stop goes below the support.
- Account Balance * percent/100 = RISK = OrderLots * (|OrderOpenPrice - OrderStopLoss| * DeltaPerLot + CommissionPerLot) (Note OOP-OSL includes the SPREAD, and DeltaPerLot is usually around $10/pip but it takes account of the exchange rates of the pair vs. your account currency.)
- Do NOT use TickValue by itself - DeltaPerLot
- You must normalize lots
properly and check against min and max.
- You must also check FreeMargin to avoid stop out
Thank you for taking the time to wade through my code. Your comments are helpful. This code needs a major overhaul. I think I'm capable of implementing your improvements.
Regards,
Brian
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I have an indicator I've written and it does the job on most of my forex pairs. I have an Oanda account and in the symbols list there is a tab "ForexT". Any pair in this list that I try and add my indicator to it doesn't appear. If I add indicators written by others they work.
Hopefully there is an easy fix for this. I don't want to post my code if I don't have to. Its a mess and I'm embarassed by it.