• Home
  • Forums
  • Trades
  • News
  • Calendar
  • Market
  • Brokers
  • Login
  • Join
  • User/Email: Password:
  • 10:04pm
Menu
  • Forums
  • Trades
  • News
  • Calendar
  • Market
  • Brokers
  • Login
  • Join
  • 10:04pm
Sister Sites
  • Metals Mine
  • Energy EXCH
  • Crypto Craft

Options

Bookmark Thread

First Page First Unread Last Page Last Post

Print Thread

Similar Threads

Help me to add ADX filter to my EA 1 reply

Can someone add filter to this MA alert 33 replies

Add entry filter to 2EMA cross indicator 2 replies

Coding Help Needed: Please Add Email Alerts to MT4 Indicator 0 replies

Help adding a filter to the Freebie Indicator 3 replies

  • Platform Tech
  • /
  • Reply to Thread
  • Subscribe
Tags: help needed: update EA / add indicator filter
Cancel

help needed: update EA / add indicator filter

  • Post #1
  • Quote
  • First Post: Jul 12, 2022 9:29am Jul 12, 2022 9:29am
  •  pgtips
  • | Joined Nov 2007 | Status: Member | 162 Posts
Hi,
I have an EA which works ok.
I want to add a filter based on an indicator (I have source code for)
That's it, add filter to EA.

But I thought I had coded this ok but it did not execute trade so I have made an error adding the indicator filter.

I remove what I added the EA works ok so I need to learn my mistake and need an MT4 programmer. I will pay if someone can help please. I want to learn what mistake I have made.

Please get in touch,
thank you
PG
  • Post #2
  • Quote
  • Jul 13, 2022 9:14am Jul 13, 2022 9:14am
  •  RedLineFred
  • Joined Sep 2012 | Status: Member | 327 Posts
If you have the source code for the indi you should be able to work out what the indi is signaling on the current bar.
Ignore all the previous bars/signals and try to incorporate what is happening on the current bar only and use this information to inform your trading decision.
You dont need to recreate the indicator for anything other than what is happening right now.
If all else fails you could use the iCustom command to interogate the indi from within the EA.
cheers Fred
" check out The Traders Outpost "
 
 
  • Post #3
  • Quote
  • Jul 13, 2022 10:04am Jul 13, 2022 10:04am
  •  pgtips
  • | Joined Nov 2007 | Status: Member | 162 Posts
Thanks Fred,
I'll look at iCustom command but if that fails I'll see if anyone on freelancer can help, its thrown me completely, must be the tiniest thing!
 
 
  • Post #4
  • Quote
  • Last Post: Jul 14, 2022 10:04am Jul 14, 2022 10:04am
  •  pgtips
  • | Joined Nov 2007 | Status: Member | 162 Posts
Hi,
further help appreciated, I think I must be closer
I have the following code. I worked from another working EA I have.
I cannot explian why I have Signal, SignalBuy and SignalSell but for my purpose I have buy and sell from the indicator
Code that is inside Expert tick function
void OnTick()
Inserted Code
int sft=1;
double OB_ident1=iCustom(NULL,0,"OB ident4Dax",OB_Set_MinBarHeight,OB_Set_MaxBarHeight,OB_Set_CloseWithinXpct,OB_Set_MinBodyPct,OB_Set_MustFollowOppColor,OB_Set_EngulfMarginPct,OB_Set_EngulfTolerance,OB_Set_StartHour,OB_Set_EndHour,0,sft);
double OB_ident2=iCustom(NULL,0,"OB ident4Dax",OB_Set_MinBarHeight,OB_Set_MaxBarHeight,OB_Set_CloseWithinXpct,OB_Set_MinBodyPct,OB_Set_MustFollowOppColor,OB_Set_EngulfMarginPct,OB_Set_EngulfTolerance,OB_Set_StartHour,OB_Set_EndHour,1,sft);
double OB_ident3=iCustom(NULL,0,"OB ident4Dax",OB_Set_MinBarHeight,OB_Set_MaxBarHeight,OB_Set_CloseWithinXpct,OB_Set_MinBodyPct,OB_Set_MustFollowOppColor,OB_Set_EngulfMarginPct,OB_Set_EngulfTolerance,OB_Set_StartHour,OB_Set_EndHour,2,sft);
double OB_ident4=iCustom(NULL,0,"OB ident4Dax",OB_Set_MinBarHeight,OB_Set_MaxBarHeight,OB_Set_CloseWithinXpct,OB_Set_MinBodyPct,OB_Set_MustFollowOppColor,OB_Set_EngulfMarginPct,OB_Set_EngulfTolerance,OB_Set_StartHour,OB_Set_EndHour,3,sft);
double OB_ident5=iCustom(NULL,0,"OB ident4Dax",OB_Set_MinBarHeight,OB_Set_MaxBarHeight,OB_Set_CloseWithinXpct,OB_Set_MinBodyPct,OB_Set_MustFollowOppColor,OB_Set_EngulfMarginPct,OB_Set_EngulfTolerance,OB_Set_StartHour,OB_Set_EndHour,4,sft);
double OB_ident6=iCustom(NULL,0,"OB ident4Dax",OB_Set_MinBarHeight,OB_Set_MaxBarHeight,OB_Set_CloseWithinXpct,OB_Set_MinBodyPct,OB_Set_MustFollowOppColor,OB_Set_EngulfMarginPct,OB_Set_EngulfTolerance,OB_Set_StartHour,OB_Set_EndHour,5,sft);
double OB_ident7=iCustom(NULL,0,"OB ident4Dax",OB_Set_MinBarHeight,OB_Set_MaxBarHeight,OB_Set_CloseWithinXpct,OB_Set_MinBodyPct,OB_Set_MustFollowOppColor,OB_Set_EngulfMarginPct,OB_Set_EngulfTolerance,OB_Set_StartHour,OB_Set_EndHour,6,sft);
double OB_ident8=iCustom(NULL,0,"OB ident4Dax",OB_Set_MinBarHeight,OB_Set_MaxBarHeight,OB_Set_CloseWithinXpct,OB_Set_MinBodyPct,OB_Set_MustFollowOppColor,OB_Set_EngulfMarginPct,OB_Set_EngulfTolerance,OB_Set_StartHour,OB_Set_EndHour,7,sft);
double Volume1=iVolume(NULL,0,sft);
Inserted Code
bool Signal = ((OB_ident1!=EMPTY_VALUE||OB_ident2!=EMPTY_VALUE||OB_ident3!=EMPTY_VALUE||OB_ident4!=EMPTY_VALUE||OB_ident5!=EMPTY_VALUE||OB_ident6!=EMPTY_VALUE||OB_ident7!=EMPTY_VALUE||OB_ident8!=EMPTY_VALUE));
bool SignalBuy = ((OB_ident5!=EMPTY_VALUE||OB_ident6!=EMPTY_VALUE||OB_ident7!=EMPTY_VALUE||OB_ident8!=EMPTY_VALUE) || OBIdentOff);
bool SignalSell= ((OB_ident1!=EMPTY_VALUE||OB_ident2!=EMPTY_VALUE||OB_ident3!=EMPTY_VALUE||OB_ident4!=EMPTY_VALUE) || OBIdentOff);
Then I used the Signal for buy or Sell into
Inserted Code
bool SUp1= (OBSignalBuy|| !UseOBIdentIndicator)&&(AS_Up_signal1 || !UseASIndicator)&&(macd_rsi_Up_signal1 || !UseMacd_rsiIndicator)&&(MACross1_Up_signal1 || !UseMACross1Indicator)&&(MACross2_Up_signal1 || !UseMACross2Indicator)&&(MACross3_Up_signal1 || !UseMACross3Indicator) &&(UseASIndicator||UseMacd_rsiIndicator||UseMACross1Indicator||UseMACross2Indicator||UseMACross3Indicator||UseMACross4Indicator);
   bool SDn1= (OBSignalSell|| !UseOBIdentIndicator)&&(AS_Dn_signal1 || !UseASIndicator)&&(macd_rsi_Dn_signal1 || !UseMacd_rsiIndicator)&&(MACross1_Dn_signal1 || !UseMACross1Indicator)&&(MACross2_Dn_signal1 || !UseMACross2Indicator)&&(MACross3_Dn_signal1 || !UseMACross3Indicator) &&(UseASIndicator||UseMacd_rsiIndicator||UseMACross1Indicator||UseMACross2Indicator||UseMACross3Indicator||UseMACross4Indicator);
  
   bool SUp2= (OBSignalBuy|| !UseOBIdentIndicator)&&(AS_Up_signal2 || !UseASIndicator)&&(macd_rsi_Up_signal2 || !UseMacd_rsiIndicator)&&(MACross1_Up_signal2 || !UseMACross1Indicator)&&(MACross2_Up_signal2 || !UseMACross2Indicator)&&(MACross3_Up_signal2 || !UseMACross3Indicator)&&(MACross4_Up_signal2 || !UseMACross3Indicator) &&(UseASIndicator||UseMacd_rsiIndicator||UseMACross1Indicator||UseMACross2Indicator||UseMACross3Indicator||UseMACross4Indicator);
   bool SDn2= (OBSignalSell|| !UseOBIdentIndicator)&&(AS_Dn_signal2 || !UseASIndicator)&&(macd_rsi_Dn_signal2 || !UseMacd_rsiIndicator)&&(MACross1_Dn_signal2 || !UseMACross1Indicator)&&(MACross2_Dn_signal2 || !UseMACross2Indicator)&&(MACross3_Dn_signal2 || !UseMACross3Indicator)&&(MACross4_Dn_signal2 || !UseMACross3Indicator) &&(UseASIndicator||UseMacd_rsiIndicator||UseMACross1Indicator||UseMACross2Indicator||UseMACross3Indicator||UseMACross4Indicator);
And it does nothing. I admit I am over my head but I want to keep trying if someone can assist or give me some further guidance.
Thank you,
PG
 
 
  • Platform Tech
  • /
  • help needed: update EA / add indicator filter
  • Reply to Thread
0 traders viewing now
Top of Page
  • Facebook
  • Twitter
About FF
  • Mission
  • Products
  • User Guide
  • Media Kit
  • Blog
  • Contact
FF Products
  • Forums
  • Trades
  • Calendar
  • News
  • Market
  • Brokers
  • Trade Explorer
FF Website
  • Homepage
  • Search
  • Members
  • Report a Bug
Follow FF
  • Facebook
  • Twitter

FF Sister Sites:

  • Metals Mine
  • Energy EXCH
  • Crypto Craft

Forex Factory® is a brand of Fair Economy, Inc.

Terms of Service / ©2023