NexusFi: Find Your Edge


Home Menu

 





A little help with EA code using icustom please


Discussion in Platforms and Indicators

Updated
    1. trending_up 1,953 views
    2. thumb_up 0 thanks given
    3. group 1 followers
    1. forum 1 posts
    2. attach_file 2 attachments




 
Search this Thread
  #1 (permalink)
 
ryangillespie's Avatar
 ryangillespie 
london, England
 
Experience: Intermediate
Platform: Ninjatrader
Trading: CL, ES
Posts: 41 since Nov 2011
Thanks Given: 10
Thanks Received: 2

Hi all,

I am trying to learn how to programme my own expert advisor, i am sure you will all be shocked at how simple this code is but I am learning so please help me and point out where I am going wrong.

I have an indicator that I use, super_signals_v2_Alert.mq4, this paints green or red buy and sell signals and then sound an alert. When a green signal is painted I would like to open a long market order at the open of the next bar.

When a red signal is painted I would like to open a shoprt market entry at the open of the next bar.

If a long position is open and anotherr signal is painted in the same direction, it is ignored, only 1 trade open in any direction at any time.

If an opposing signal sounds then this closes the trade. I would like to have an option to have the EA always in the market so reverse when an opposing signal is triggered.

I have been trying to get this right but I am having no luck...

Here is what I have so far but I am not sure if the condition to open and close is correct as per the indicator as it doesnt open trades when the indicator alarms, it only buys and opens multiple trades in the same direction.

#include <stdlib.mqh>

extern double downtrend;// downtrend=iCustom(NULL,0,"super_signals_v2_alert",1,0); ???
extern double uptrend; // uptrend=iCustom(NULL,0,"super_signals_v2_alert",0,0); ???
extern int dist2=21;
extern int SignalBar=1;
input double lots=3;
input double TakeProfit=550;
int OpenOrders=0, cnt=0;

int start()

{

int downtrend = iHighest(NULL,0,MODE_HIGH,dist2,SignalBar-dist2/2);
int uptrend = iLowest(NULL,0,MODE_LOW,dist2,SignalBar-dist2/2);


if(downtrend && OpenOrders<1)
{
bool ticket=OrderSend(Symbol(),OP_SELL,lots,Bid,3,0,Bid+TakeProfit*Point,NULL,0,0,clrRed);
}
else if(uptrend && OpenOrders<1)
{
ticket=OrderSend(Symbol(),OP_BUY,lots,Ask,3,0,Ask+TakeProfit*Point,NULL,0,0,clrGreen);


}
}



Can someone please help me out here, it would be greatly appreciated.

Thanks


Attached Files
Elite Membership required to download: tester.mq4
Elite Membership required to download: super_signals_v2_Alert.mq4
Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
After $87M Settles NO: Irans Nuclear Redline Sets Up the …
Prediction Markets & Event Contracts
Topstep Slashes XFA Payout Caps by Up to 60% -- Flagship …
Funded Trading Evaluation Firms
Warsh Confirmed 54-45 on PPI Day -- 97% Say He Holds in …
Prediction Markets & Event Contracts
SEC Advisory Committee Backs Tokenized Securities Exempt …
Traders Hideout
CME Raises Energy Futures Margins After Iran-War Volatil …
Commodities
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Sober Journey With S&P
24 thanks
2026 Jlab journal
10 thanks
Lady Vols Primer: Trading Volatility Journal
7 thanks
Algo automated / semi-automated trading anyone?
6 thanks
Trying to learn Volume and price action correlation
5 thanks




Last Updated on May 6, 2014


© 2026 NexusFi®, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Downloads - Top
no new posts