Watch how to download trading robots for free
Find us on Twitter!
Join our fan page
Join our fan page
You liked the script? Try it in the MetaTrader 5 terminal
- Views:
- 344
- Rating:
- Published:
-
Need a robot or indicator based on this code? Order it on Freelance Go to Freelance
I'll try to detail here what the robot does
CopyTrader - Detailed Operation
CopyTrader - Detailed Operation
OnInit(
)
Creates/opens the SQLite database"CopyTrader.sqlite"
Creates two tables if they don't exist:
signals: to store active signals signals_history: to store signal history
Initial Check (CheckInitialOrders)
Checks all open positions, for each position with the correct MAGIC_NUMBER: Records in the bank as a "NEW" signal Stores in control arrays (previous_orders and previous_positions)
OnTradeTransaction()
Modification of SL/TP(TRADE_TRANSACTION_REQUEST)
Detects whenSL/TPismodified (TRADE_ACTION_SLTP) Checks if the position belongs to EA (MAGIC_NUMBER) Sends "MODIFY" signal to the bank with new values
New Position (TRADE_TRANSACTION_DEAL_ADD)
Detects when a new position is opened Checks whether it's a buy or sell (DEAL_TYPE_BUY or DEAL_TYPE_SELL) Checks MAGIC_NUMBER
If it's an entry (DEAL_ENTRY_IN): Sends "NEW" signal to bank with position details
- Position closure (TRADE_TRANSACTION_HISTORY_ADD)
Detects when a position is closed Checks history of deals If it finds an exit (DEAL_ENTRY_OUT): Sends "CLOSE" signal to the bank
Signal Functions
1.SendNewOrderSignal
Registersa new order with the bank Stores ticket, symbol, type, volume, price, SL and TP SendModifySignal Registers order modification in the bank Updates SL and TP SendCloseSignal Records order closure in the bank Marks order as closed
Database(CSignalDB)
WriteSignal Adds new signals to the database Checks for duplicate "NEW" signals UpdateSignalStatus Updates signal status MoveToHistory Moves completed signals to history table GetPendingSignals Retrieves pending signals from the bank
I'd like some help with improvements.
If it makes sense to make the robot copy in this way
Thank you in advance for your co-operation.
Another question, the real account, when I try to get the ticket, it comes up with a negative number, can you tell if that's the case? Can't you get the correct value of the ticket?
Translated from Portuguese by MetaQuotes Ltd.
Original code: https://www.mql5.com/pt/code/54032

An indicator to detect and mark all popular candle patterns

A lightweight tool for manual scalping in MT5 using keyboard shortcuts

The Acceleration/Deceleration Indicator (AC) measures acceleration and deceleration of the current driving force.

Indicator edition for new platform.