Oanda ForexT

 

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.

 

We don't care about your code, if you want help post it ! No other way.

Alternatively check the log for any reported error and fix your code.

 

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

 
HardSlog:

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.
MQL5.community - User Memo
MQL5.community - User Memo
  • 2010.02.25
  • MetaQuotes Software Corp.
  • www.mql5.com
You have just registered and most likely you have questions such as, "How do I insert a picture to my a message?" "How do I format my MQL5 source code?" "Where are my personal messages kept?" You may have many other questions. In this article, we have prepared some hands-on tips that will help you get accustomed in MQL5.community and take full advantage of its available features.
 
Here it is.
Files:
 
HardSlog: Any pair in this list that I try and add my indicator to it doesn't appear.
  1.    SSMagnitude =((SwingHighLineV-SwingLowLineV)/ATR4)*10000;

       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);
    Code assumes 5 digit broker, non-JPY pair. Divide by _Point, add pip's.
    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);

  2.    ATR4Real=NormalizeDouble(iATR(NULL,ATR4Timeframe,ATR1Period,0)/Point,0);
       ATR24=NormalizeDouble(iATR(NULL,ATR24Timeframe,ATR1Period,0)/Point,0)
    Why are you including a partially formed bar in your ATR?
  3. Do NOT use NormalizeDouble, EVER. For ANY Reason. It's a kludge, don't use it. It's use is always wrong

  4.       ATR4Real=ATR4Real/1000000;
    No idea what that represents. Definitely not correct 4/5 JPY/other code.
  5.    if(TradePair == "GBPUSD" || TradePair == "EURUSD" ||TradePair == "AUDUSD" ||TradePair == "NZDUSD") OandaUnits = (DollarsRisked *10000)/ StopLoss * AusPrice;
       if(TradePair == "USDCHF" ||TradePair == "USDCAD") OandaUnits = (DollarsRisked *10000)/ StopLoss * AusPrice * CurrentPrice;
       if(TradePair == "USDJPY" ) OandaUnits = (DollarsRisked *100)/ StopLoss * AusPrice * CurrentPrice;
    Do you really think your indicator will run on other pairs? And #1
    • 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

Reason: