9911939149 support@algoji.com

MT4 Algo Trading With AliceBlue ChartBridge

Click here for initial ChartBridge installation.

Plugin Installation

Download Plugin files from here for Sample Strategy. Follow instructions below, or scroll for video to bottom of page.

  1. Login in MT4 and click on Tool then go to Option or directly press shortcut key CTRL + O
  2. In the options tab go Expert Advisors Tick all mandatory columns and click on ok button
  3. After completing 2nd step Click on File and select Open Data Folder
  4. In the data folder select MQL4 folder and open it.
  5. In MQL4 folder select “Include” folder.
  6. Inside “Include” folder paste these three files. (1) Expert_Signal.mqh (2) algotrading.mqh (3) buy_sell.mqh
  7. Go back into “MQL4” folder and select “EXPERT” folder.
  8. Inside “EXPERT” folder paste “CT” file.
  9. Go back to “MT4 Application” and select “VIEW” then select “NAVIGATOR” or simply press “CTRL + N”.
  10. Inside NAVIGATOR column select EXPERT ADVISERS .
  11. Right-click on it then select REFRESH.
  12. After refresh you can see there is new file “CT”
  13. Now simply Drag & Drop “CT” file into a chart. That’s it button strategy integration is done.

APIBridge Jump Start

Start APIBridge. In the Symbol Settings window, select Jump Start template and apply.

JumpStart Template is your first template to test drive system trading through APIBridge. No signal rules or risk management rules are applied in this template.

You will see three symbols in Symbol Settings – SBIN, NIFTY and CRUDEOIL. Let us learn how to place orders in these 3 market segments.

Trading in Equities (Cash)

  1. Change SBIN (input symbol) to your chart symbol. Example, if you see on charts HDFC-EQ, you should change this to HDFC-EQ.
  2. Change SBIN (trading symbol) to actual trading symbol for order placement. Example- HDFC. Save the settings by keypress Ctrl+S
  3. Click Start Trading
  4. On MT4, click LE button on Chart. In APIBridge, you will see messages about Signal Received and Order placed. Check Net Positions and Trade History.

Trading in Futures

  1. Change NIFTY (input symbol) to your chart symbol. Example, if you see on charts BANKNIFTY-I, you should change this to BANKNIFTY-I
  2. Change NIFTY (trading symbol) to actual trading symbol for order placement. Example- BANKNIFTY
  3. If you are trading in Stock Futures,Commodities, or Currency, remember to change Instrument from FUTIDX to FUTSTK, FUTCOM or FUTCUR respectively.
  4. Change expiry date to correct date.
  5. Save the settings by keypress Ctrl+S
  6. Click Start Trading
  7. On MT4, click LE button on Chart. In APIBridge, you will see messages about Signal Received and Order placed. Check Net Positions and Trade History.

Exploring Further – Signal Rules

  1. Go to Application Settings->Signal Settings. Tick the Rule: LE place order only in NetPos <=0. This rule protects you from trade misfire. What if you accidentally clicked LE button twice? Or you strategy repaint Buy arrows and send LE again? Test with this rule to find out.
  2. Send LE signal again from button like you did last time. It will show message:
  3. Send LX now to squareoff your net position. Check Net Positions and Trade History.
  4. Send LE again. Since, now NetPosition is 0, it will place order.
  5. TIP: If you want to scale-in to trades (or position sizing) you should keep this rule unchecked.

Exploring Further – Risk Management

  1. Go to Risk Management tab in APIBridge. Add MaxOrderPerMinute: 2 and hit Ctrl+S. This rule again helps your strategy from misfire. What if, there is continuous buy-sell signal from your strategy?
  2. Try now by quickly using buttons to send 4 signals – LE, LX, LE, LX. It will allow only first two signals to fire orders.

You can now continue exploring other features of APIBridge. Customize it to suit your requirement before starting live trading.

Using custom Expert Advisor for algo in MT4

Refer above video from 5:00 onwards

Download here required files for your custom EA algo setup.

1: Put ” Expert_Signal.mqh ” this file in Include folder of MT4 Data Folder

2: Copy Paste this  [ #include<Expert_Signal.mqh>  ] in Expert Advisor just after initialization of data variables in Expert Advisor file.

3: Search “OrderSend” Function and if OrderSend function Contain “OP_BUY” then Copy & Paste ” LongEntry(); ” after “OrderSend” Function declaration.

4: Again Search “OrderSend” Function and if OrderSend Function Contain “OP_SELL” then Copy & Paste ” ShortEntry(); ” after “OrderSend” Function declaration.

5: Now Search “OrderClose” Function and if OrderClose Function Contain “Bid” then Copy & Paste ” else { if(K==0){ LongExit(); } } ” after “OrderClose” Function declaration.

6: Again Search “OrderClose” Function and if OrderClose Function Contain “Ask” then Copy & Paste ” else { if(K==0){ ShortExit(); } } ” after “OrderClose” Function declaration.

7: Search “OrderModify” Function and if OrderModify Function Contain “Bid” then Copy & Paste ” else { if(K==0){ LongExit(); } } ” after “OrderModify” Function declaration.

8: Search “OrderModify” Function and if OrderModify Function Contain “Ask” then Copy & Paste ” else { if(K==0){ ShortExit(); } } ” after “OrderModify” Function declaration.

Some Expert advisor Doesn’t have “OrderModify” Function then just ignore 7th and 8th Point.

After this Editing..

First Compile ” Expert_Signal.mqh ” this file

NOTE- Most important point if you are trying to integrate your strategy with APIBridge then you need to have( .mql4 file). (.Ex4) files alone cannot be integrated as they are locked and you cannot edit the code

MT4 Options Auto Strike Selection