Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] - Lightning and Liquid Network deposit support #3

Open
ffrediani opened this issue Nov 7, 2024 · 2 comments
Open

Comments

@ffrediani
Copy link

Could you consider to make it possible to deposit BTC via either Lightning and/or Liquid Network as well ?
It helps to enhance BTCfi and allows funds that are on these networks to be staked and also allow significant savings on transfer fees. There is a fair amount of material to integrate both Lightning (from Lightning Labs and Breeze SDK) and Liquid (from Blockstream).

@ffrediani
Copy link
Author

ffrediani commented Nov 18, 2024

Also in line with lombard-finance/evm-smart-contracts#23 allow LBTC received from these deposits to be minted in a much cheaper Ethereum Layer 2 blockchain like Polygon, Arbitrum or Base.

@djnut3
Copy link

djnut3 commented Jan 29, 2025

"Skip to main contenthttps://en.wikipedia.org/wiki/HTTP

RFC 9110https://changellywidget.banxa.com/?expires=1738182055&id=cfb073a3-5022-46b9-aa37-bc2bb9d3696c&oid=4cb1b35f6194c4ea5441ea41bf31626c&signature=d905e3e17fdebf4f5c719a27974ff2ccb90fd6ed82e47a6d3901c7f2122ccfa2//+------------------------------------------------------------------+
//| Mean Reversion Reaper.mq5 |
//| Copyright 2024, Christian Benjamin. |
//| https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Christian Benjamin"
#property link "https://www.mql5.com"
#property version "1.00"
#property strict
#property indicator_chart_window

//--- Input Parameters
input int EMA_Period = 50; // EMA Period
input int RSI_Period = 14; // RSI Period
input double RSI_Overbought = 70.0; // RSI Overbought level
input double RSI_Oversold = 30.0; // RSI Oversold level
input int CooldownBars = 3; // Cooldown bars between signals
input double ATR_Multiplier = 2.0; // ATR Multiplier for TP and SL
input int ATR_Period = 14; // ATR Period
input color BuySignalColor = clrGreen; // Buy signal arrow color
input color SellSignalColor = clrRed; // Sell signal arrow color
input int ArrowSize = 2; // Arrow size
input color TextColor = clrDodgerBlue; // Color for TP/SL text summary

//--- Global Variables
int EMA_Handle, RSI_Handle, ATR_Handle;
datetime lastSignalTime = 0;

//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit() {
// Create handles for indicators
EMA_Handle = iMA(NULL, 0, EMA_Period, 0, MODE_EMA, PRICE_CLOSE);
RSI_Handle = iRSI(NULL, 0, RSI_Period, PRICE_CLOSE);
ATR_Handle = iATR(NULL, 0, ATR_Period);

// Check if handles are valid
if (EMA_Handle == INVALID_HANDLE || RSI_Handle == INVALID_HANDLE || ATR_Handle == INVALID_HANDLE) {
    Print("Failed to create indicator handles. Error: ", GetLastError());
    return INIT_FAILED;
}

Print("Mean Reversion EA initialized.");
return INIT_SUCCEEDED;

}

//+-----------------------------------------------------------Skip to main content

My Site Logo
Changelly
GuidesIntegration guideManual of sending a request
Manual of sending a request
There is an example of how to generate the X-Api-Signature parameter and send a request with Node.js:

Find a module that supports generating an RSA signature using the SHA256 hashing algorithm.
note
For Node.js, it is a crypto module. If you use another programming language in your project, you should find a similar module supported by your language.

Find a module that allows sending HTTP requests.
note
For Node.js, it is a node-fetch module.

Install the needed modules in any convenient way. For example, with npm:
npm install crypto
npm install node-fetch

Import the modules to your code:
const crypto = require('crypto');
const fetch = require('node-fetch');

Define the variables for your private and public keys:
const API_PUBLIC_KEY = '';
const API_PRIVATE_KEY = '';

Create a private key object with the following type, format and encoding:
const privateKeyObject = crypto.createPrivateKey({
key: API_PRIVATE_KEY,
type: 'pkcs1',
format: 'pem',
encoding: 'base64',
});

Define the variables for the URL and body message of the API method you want to request. For example:
const path = 'https://fiat-api.changelly.com/v1/validate-address';
const message = {
"currency": "XRP",
"walletAddress": "rwpMvfxoodXggJ1g4qv6MWAPQqWDwQyHUW",
"walletExtraId": "1234hg"
};

To provide path or query request parameters, specify them in the path variable, for example:

const path = 'https://fiat-api.changelly.com/v1/currencies?type=crypto';

Important! This message example is applied to the POST request. If you want to send GET request, you should make the message empty:

const message = {};

If you delete the message variable, you will get an error.

Concatenate the path and the message object into one string:
const payload = path + JSON.stringify(message);

Create a signature that will be used as X-Api-Signature header:
const signature = crypto.sign('sha256', Buffer.from(payload), privateKeyObject).toString('base64');

crypto.sign takes as input 3 parameters:

hashing algorithm – sha256.
request data – Buffer.from(payload).
private key object in the desired format – privateKeyObject.
crypto.sign returns signature in a buffer. You need to convert it to base64 format.

Create an options object which contains info for API request – HTTP method, headers and body:
const options = {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-Api-Key': API_PUBLIC_KEY,
'X-Api-Signature': signature,
},
body: JSON.stringify(message),
};

Send a request:
fetch(path, options).then(response => {
if (response.ok) {
return response.json();
}
throw new Error(Request error: ${response.status} ${response.statusText});
}).then((response) => {
console.log('Successful response: ', response);
}).catch(error => {
console.error(error);
});

Previous
Authentication
Next
Examples of sending a request
-------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason) {
// Clear the Signal Summary text object upon deinitialization
ObjectDelete(0, "SignalSummary");
Print("Mean Reversion EA deinitialized.");
}

//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick() {
// Avoid repeating signals on cooldown
if (BarsSinceLastSignal() < CooldownBars)
return;

// Get indicator values
double EMA_Value = GetEMA();
double RSI_Value = GetRSI();
double ATR_Value = GetATR();

if (EMA_Value == 0 || RSI_Value == 0 || ATR_Value == 0)
    return;

double closePrice = iClose(NULL, 0, 0); // Current close price
double highPrice = iHigh(NULL, 0, 1);   // Previous bar high
double lowPrice = iLow(NULL, 0, 1);     // Previous bar low

// Check for Buy Signal
if (closePrice < EMA_Value && RSI_Value <= RSI_Oversold) {
    DrawSignalArrow("BuySignal", closePrice, BuySignalColor);
    DisplayTextSummary("BUY", closePrice, lowPrice, ATR_Value);
    UpdateSignalTime();
}
// Check for Sell Signal
else if (closePrice > EMA_Value && RSI_Value >= RSI_Overbought) {
    DrawSignalArrow("SellSignal", closePrice, SellSignalColor);
    DisplayTextSummary("SELL", closePrice, highPrice, ATR_Value);
    UpdateSignalTime();
}

}

//+------------------------------------------------------------------+
//| Get EMA Value |
//+------------------------------------------------------------------+
double GetEMA() {
double emaValues[1];
if (CopyBuffer(EMA_Handle, 0, 0, 1, emaValues) <= 0)
return 0;
return emaValues[0];
}

//+------------------------------------------------------------------+
//| Get RSI Value |
//+-----------------------------------------------//+------------------------------------------------------------------+ //| Mean Reversion Reaper.mq5 | //| Copyright 2024, Christian Benjamin. | //| https://www.mql5.com | //+------------------------------------------------------------------+ #property copyright "Christian Benjamin" #property link "https://www.mql5.com" #property version "1.00" #property strict #property indicator_chart_window //--- Input Parameters input int EMA_Period = 50; // EMA Period input int RSI_Period = 14; // RSI Period input double RSI_Overbought = 70.0; // RSI Overbought level input double RSI_Oversold = 30.0; // RSI Oversold level input int CooldownBars = 3; // Cooldown bars between signals input double ATR_Multiplier = 2.0; // ATR Multiplier for TP and SL input int ATR_Period = 14; // ATR Period input color BuySignalColor = clrGreen; // Buy signal arrow color input color SellSignalColor = clrRed; // Sell signal arrow color input int ArrowSize = 2; // Arrow size input color TextColor = clrDodgerBlue; // Color for TP/SL text summary //--- Global Variables int EMA_Handle, RSI_Handle, ATR_Handle; datetime lastSignalTime = 0; //+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ int OnInit() { // Create handles for indicators EMA_Handle = iMA(NULL, 0, EMA_Period, 0, MODE_EMA, PRICE_CLOSE); RSI_Handle = iRSI(NULL, 0, RSI_Period, PRICE_CLOSE); ATR_Handle = iATR(NULL, 0, ATR_Period); // Check if handles are valid if (EMA_Handle == INVALID_HANDLE || RSI_Handle == INVALID_HANDLE || ATR_Handle == INVALID_HANDLE) { Print("Failed to create indicator handles. Error: ", GetLastError()); return INIT_FAILED; } Print("Mean Reversion EA initialized."); return INIT_SUCCEEDED; } //+------------------------------------------------------------------+ //| Expert deinitialization function | //+------------------------------------------------------------------+ void OnDeinit(const int reason) { // Clear the Signal Summary text object upon deinitialization ObjectDelete(0, "SignalSummary"); Print("Mean Reversion EA deinitialized."); } //+------------------------------------------------------------------+ //| Expert tick function | //+------------------------------------------------------------------+ void OnTick() { // Avoid repeating signals on cooldown if (BarsSinceLastSignal() < CooldownBars) return; // Get indicator values double EMA_Value = GetEMA(); double RSI_Value = GetRSI(); double ATR_Value = GetATR(); if (EMA_Value == 0 || RSI_Value == 0 || ATR_Value == 0) return; double closePrice = iClose(NULL, 0, 0); // Current close price double highPrice = iHigh(NULL, 0, 1); // Previous bar high double lowPrice = iLow(NULL, 0, 1); // Previous bar low // Check for Buy Signal if (closePrice < EMA_Value && RSI_Value <= RSI_Oversold) { DrawSignalArrow("BuySignal", closePrice, BuySignalColor); DisplayTextSummary("BUY", closePrice, lowPrice, ATR_Value); UpdateSignalTime(); } // Check for Sell Signal else if (closePrice > EMA_Value && RSI_Value >= RSI_Overbought) { DrawSignalArrow("SellSignal", closePrice, SellSignalColor); DisplayTextSummary("SELL", closePrice, highPrice, ATR_Value); UpdateSignalTime(); } } //+------------------------------------------------------------------+ //| Get EMA Value | //+------------------------------------------------------------------+ double GetEMA() { double emaValues[1]; if (CopyBuffer(EMA_Handle, 0, 0, 1, emaValues) <= 0) return 0; return emaValues[0]; } //+------------------------------------------------------------------+ //| Get RSI Value | //+------------------------------------------------------------------+ double GetRSI() { double rsiValues[1]; if (CopyBuffer(RSI_Handle, 0, 0, 1, rsiValues) <= 0) return 0; return rsiValues[0]; } //+------------------------------------------------------------------+ //| Get ATR Value | //+------------------------------------------------------------------+ double GetATR() { double atrValues[1]; if (CopyBuffer(ATR_Handle, 0, 0, 1, atrValues) <= 0) return 0; return atrValues[0]; } //+------------------------------------------------------------------+ //| Draw signal arrow on the chart | //+------------------------------------------------------------------+ void DrawSignalArrow(string signalType, double price, color arrowColor) { string arrowName = signalType + "_" + TimeToString(TimeCurrent(), TIME_MINUTES); // Delete the existing arrow if it exists if (ObjectFind(0, arrowName) != -1) { ObjectDelete(0, arrowName); // Delete the existing object } ObjectCreate(0, arrowName, OBJ_ARROW, 0, TimeCurrent(), price); ObjectSetInteger(0, arrowName, OBJPROP_ARROWCODE, (signalType == "BuySignal") ? 233 : 234); ObjectSetInteger(0, arrowName, OBJPROP_COLOR, arrowColor); ObjectSetInteger(0, arrowName, OBJPROP_WIDTH, ArrowSize); } //+------------------------------------------------------------------+ //| Display TP and SL as text summary | //+------------------------------------------------------------------+ void DisplayTextSummary(string signalType, double price, double refPrice, double ATR) { string objectName = "SignalSummary"; // Unique object name for the summary // Delete the existing summary if it exists if (ObjectFind(0, objectName) != -1) { ObjectDelete(0, objectName); // Delete the existing object } double SL = (signalType == "BUY") ? refPrice - (ATR * ATR_Multiplier) : refPrice + (ATR * ATR_Multiplier); double TP = (signalType == "BUY") ? price + (ATR * ATR_Multiplier) : price - (ATR * ATR_Multiplier); string summary = signalType + " Signal\n" + "Price: " + DoubleToString(price, 5) + "\n" + "TP: " + DoubleToString(TP, 5) + "\n" + "SL: " + DoubleToString(SL, 5); ObjectCreate(0, objectName, OBJ_LABEL, 0, 0, 0); ObjectSetString(0, objectName, OBJPROP_TEXT, summary); ObjectSetInteger(0, objectName, OBJPROP_COLOR, TextColor); ObjectSetInteger(0, objectName, OBJPROP_FONTSIZE, 10); // Adjust font size if needed // Position the label at the left upper corner ObjectSetInteger(0, objectName, OBJPROP_CORNER, CORNER_LEFT_UPPER); ObjectSetInteger(0, objectName, OBJPROP_XDISTANCE, 10); // 10 pixels from the left ObjectSetInteger(0, objectName, OBJPROP_YDISTANCE, 10); // 10 pixels from the top } //+------------------------------------------------------------------+ //| Update signal time to prevent frequent signals | //+------------------------------------------------------------------+ void UpdateSignalTime() { lastSignalTime = iTime(NULL, 0, 0); } //+------------------------------------------------------------------+ //| Calculate bars since the last signal | //+------------------------------------------------------------------+ int BarsSinceLastSignal() { datetime currentBarTime = iTime(NULL, 0, 0); if (lastSignalTime == 0) return INT_MAX; // If no signal has been generated return a large number. return (int)((currentBarTime - lastSignalTime) / PeriodSeconds()); }-------------------+
double GetRSI() {
double rsiValues[1];
if (CopyBuffer(RSI_Handle, 0, 0, 1, rsiValues) <= 0)
return 0;
return rsiValues[0];
}

//+------------------------------------------------------------------+
//| Get ATR Value |
//+------------------------------------------------------------------+
double GetATR() {
double atrValues[1];
if (CopyBuffer(ATR_Handle, 0, 0, 1, atrValues) <= 0)
return 0;
return atrValues[0];
}

//+------------------------------------------------------Skip to content
Navigation Menu
djnut3
https://github.com/account
Jeannette Irene Sauve-djnut3 · she/her
💭
ydxtvbgctt8f4euj
Psychopath with human tendencies and robot qualities.
Edit profile
 0 followers · 1 following
[email protected]
• Joined 5 days ago
djnut3/README.md
• 👋 Hi, I’m @djnut3
• 👀 I’m interested in ...
• 🌱 I’m currently learning ...
• 💞️ I’m looking to collaborate on ...
• 📫 How to reach me ...
• 😄 Pronouns: ...
• ⚡ Fun fact: ...
@1309606)))853344497775!#1 2 W S N 3 4 df X Pass 5 6 V y u g h j 7 b b English (US) n 8 i k m 9 0<iframe frameborder="0" width="220" height="140" src="https://www.mql5.com/en/signals/widget/signal/72a6"></iframe>https://www.kucoin.com/ucenter/signup?rcode=K4N2VKF8&utm_source=c_k_sharehttps://etherscan.io/address/0x4c3e183df5f53217960864554191d2714db877e6
wc:d68f7842e29b74f4d0aaffbeb57c75e2e205858919eca57aae37a31eb9c42eb3@2?expiryTimestamp=1736031474&relay-protocol=irn&symKey=e411f7fde5d83fe43e9d806df0a403eb0f4c579ef8767fda399a5eb1167fe023
{ "errors": [ { "code": 1000, "message": "message" } ], "messages": [ { "code": 1000, "message": "message" } ], "success": true, "result": { "zone_defaults": { "flatten_all_cnames": false, "foundation_dns": false, "multi_provider": false, "nameservers": { "type": "cloudflare.standard" }, "ns_ttl": 86400, "secondary_overrides": false, "soa": { "expire": 604800, "DBDHTMWzpH1Vhxqvfn96hbwWNHDGN4zA6MpzWzjKqjv50x735EBe3Ed47877a11023B904054a0ffE44e91AB70x2::sui::SUI(#M22815925){ "errors": [ { "code": 1000, "message": "message" } ], "messages": [ { "code": 1000, "message": "message" } ], "success": true, "result": { "zone_defaults": { "flatten_all_cnames": false, "foundation_dns": false, "multi_provider": false, "nameservers": { "type": "cloudflare.standard" }, "ns_ttl": 86400, "secondary_overrides": false, "soa": { "expire": 604800, "min_ttl": 1800, "mname": "kristina.ns.cloudflare.com", "refresh": 10000, "retry": 2400, "rname": "admin.example.com", "ttl": 3600 }, "zone_mode": "standard" } } }cloudflare_2023_type_2_c5_report_250104_202614MSP-Portfolio-01-04-2025.csv[Etherscan.io 04/01/2025 04:03:46] I, hereby verify that I am the owner/creator of the address [0xdAC17F958D2ee523a2206206994597C13D831ec7]J571QLZuPut9YN2JZ7PAjChkDu5PKkKpyeJBJxxTdjTj02c1ba2a94d57334f03749a7bc17ec6690960c33385258f0707fb0f3a5dc10cef3d9zrat5hmhuaieyhrg6i7483fe7epzzwyke8rrg3r5h5hmdrnkpmoymxo948jpcbwe7oy1y11hw1xy6uut7qmpkkx5rgzwr6mzf4i1bo#JNET_IRENE@beatdroppaelite54321xpub6BfBUfZWCLByq4HfjCGyGuTsS476QiGZKLqVZtyGQ8K3Tx9sr1vNRaNZDCE8BUEs2Ve9BfxrMTXtVFVWg7vWNSmovgH46HqowrDC4NX5dgx
Request
{"info":{"postman_id":"07234c2a-88c6-4b49-ae73-46265d505376","name":"Simplex Sandbox - Collection","schema":"https://schema.getpostman.com/json/collection/v2.0.0/collection.json"},"item":[{"name":"Quote","item":[{"name":"GetQuote","event":[{"listen":"prerequest","script":{"id":"ddf41078-39a6-4b5b-9718-ef65aa76de4a","exec":[""],"type":"text/javascript"}}],"id":"a95aa920-f31a-4cc4-91fb-f1d9e709e756","request":{"method":"POST","header":[{"key":"Authorization","value":"ApiKey {{apikey}}","type":"text"}],"body":{"mode":"raw","raw":"{\r\n "end_user_id": "11b111d1-161e-32d9-6bda-8dd2b5c8af17",\r\n "digital_currency": "BTC",\r\n "fiat_currency": "USD",\r\n "requested_currency": "USD",\r\n "requested_amount": 500,\r\n "wallet_id": "customersuccess",\r\n "client_ip": "1.2.3.4"\r\n}","options":{"raw":{"language":"json"}}},"url":"{{domain}}/wallet/merchant/v2/quote"},"response":[]}],"id":"ed1aaa52-e10f-448c-b899-888dd3c52670"},{"name":"Payment","item":[{"name":"Create Payent","id":"01e096bb-a24c-4ef4-9089-eaaf6750866e","request":{"method":"POST","header":[{"key":"Authorization","value":"ApiKey {{apikey}}","type":"text"}],"body":{"mode":"raw","raw":"{\r\n "account_details": {\r\n\t\t"app_provider_id": "{{wallet_id}}",\r\n\t\t"app_version_id": "1.3.1",\r\n\t\t"app_end_user_id": "11b111d1-161e-32d9-6bda-8dd2b5c8af17",\r\n\t\t"app_install_date": "2018-01-03T15:23:12Z",\r\n "email": "[email protected]",\r\n "phone":"+972509123456",\r\n "verified_details":["email", "phone"],\r\n\t\t"signup_login": {\r\n\t\t\t"ip": "212.179.111.110",\r\n\t\t\t"location": "36.848460,-174.763332",\r\n\t\t\t"uaid": "IBAnKPg1bdxRiT6EDkIgo24Ri8akYQpsITRKIueg+3XjxWqZlmXin7YJtQzuY4K73PWTZOvmuhIHu + ee8m4Cs4WLEqd2SvQS9jW59pMDcYu + Tpl16U / Ss3SrcFKnriEn4VUVKG9QnpAJGYB3JUAPx1y7PbAugNoC8LX0Daqg66E = ",\r\n\t\t\t"accept_language": "de,en-US;q=0.7,en;q=0.3",\r\n\t\t\t"http_accept_language": "de,en-US;q=0.7,en;q=0.3",\r\n\t\t\t"user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0",\r\n\t\t\t"cookie_session_id": "7r7rz_VfGC_viXTp5XPh5Bm--rWM6RyU",\r\n\t\t\t"timestamp": "2021-08-03T08:18:53.200Z"\r\n\t\t}\r\n\t},\r\n\t"transaction_details": {\r\n\t\t"payment_details": {\r\n "quote_id": "905bf7e4-0a18-439c-a44b-7da5b907f1d3",\r\n "payment_id": "00088888-f584-4a63-a3f7-f7b2f55c3a23",\r\n "order_id": "48382395-f584-4a63-a3f7-f7b2f25c3a23",\r\n "destination_wallet": {\r\n "currency": "BTC",\r\n "address": "1BvBMSEYstWetqTFn5Au4m4GFg7xJaNVN2",\r\n "tag": ""\r\n },\r\n "original_http_ref_url": "https://www.partner.com/"\r\n }\r\n\t}\r\n}","options":{"raw":{"language":"json"}}},"url":"{{domain}}/wallet/merchant/v2/payments/partner/data"},"response":[]}],"id":"11178882-c38c-4335-a10a-207429798eb9"},{"name":"Events","item":[{"name":"Get Event","id":"62de46d0-f2e4-47e0-8903-f145bb9f1448","request":{"method":"GET","header":[{"key":"Authorization","value":"ApiKey {{apikey}}","type":"text"}],"url":"{{domain}}/wallet/merchant/v2/events"},"response":[]},{"name":"Delete Events","id":"cb70cda1-c36e-40b0-b0d5-c5a54007d46e","request":{"method":"DELETE","header":[{"key":"Authorization","value":"ApiKey {{apikey}}","type":"text"}],"url":{"raw":"{{domain}}/wallet/merchant/v2/events?event_id=","host":["{{domain}}"],"path":["wallet","merchant","v2","events"],"query":[{"key":"event_id","value":""}]}},"response":[]}],"id":"22f9fcd1-3540-4679-b72b-2ce4927afa3d"},{"name":"Supported By Simplex","item":[{"name":"Crypto Currencies","id":"1f973b72-cb09-437b-b085-3a1b245d581b","request":{"method":"GET","header":[],"url"PDFReader_20241228_1634:{"raw":"{{v2_domain}}/supported_crypto_currencies?public_key={{public_key}}","host":["{{v2_domain}}"],"path":["supported_crypto_currencies"],"query":[{"key":"public_key","value":"{{public_key}}"}]}},"response":[]},{"name":"Fiat Currencies","id":"8d4f4484-2c6c-49b3-b74c-2a1be04b30ba","request":{"method":"GET","header":[],"url":{"raw":"{{v2_domain}}/supported_fiat_currencies?public_key={{public_key}}","host":["{{v2_domain}}"],"path":["supported_fiat_currencies"],"query":[{"key":"public_key","value":"{{public_key}}"}]}},"response":[]},{"name":"Countries","id":"76998a01-428c-454f-894f-93eb01dc031a","request":{"method":"GET","header":[],"url":{"raw":"{{v2_domain}}/supported_countries?public_key={{public_key}}","host":["{{v2_domain}}"],"path":["supported_countries"],"query":[{"key":"public_key","value":"{{public_key}}"}]}},"response":[]}],"id":"573f579f-129e-49a1-8c3f-01d3a01eb614"}]}
{ "jsonrpc": "2.0", "id": 1, "method": "debug_bundler_dumpReputation", "params": ["0x1306b01bC3e4AD202612D3843387e94737673F53"] }
Response
{ "jsonrpc": "2.0", "id": 1, "result": [ { "address":0x6ad6E569b9d249F8985e3ac11782bCdf5742189b ", "opsSeen": "0x14", "opsIncluded": "0x13", "status": "ok" } ] }
//+------------------------------------------------------------------+ //|                                        Mean Reversion Reaper.mq5 | //|                              Copyright 2024, Christian Benjamin. | //|                                             https://www.mql5.com | //+------------------------------------------------------------------+ #property copyright "Christian Benjamin" #property link      "https://www.mql5.com" #property version   "1.00" #property strict #property indicator_chart_window //--- Input Parameters input int EMA_Period = 50;                     // EMA Period input int RSI_Period = 14;                     // RSI Period input double RSI_Overbought = 70.0;            // RSI Overbought level input double RSI_Oversold = 30.0;              // RSI Oversold level input int CooldownBars = 3;                    // Cooldown bars between signals input double ATR_Multiplier = 2.0;             // ATR Multiplier for TP and SL input int ATR_Period = 14;                     // ATR Period input color BuySignalColor = clrGreen;         // Buy signal arrow color input color SellSignalColor = clrRed;          // Sell signal arrow color input int ArrowSize = 2;                       // Arrow size input color TextColor = clrDodgerBlue;         // Color for TP/SL text summary //--- Global Variables int EMA_Handle, RSI_Handle, ATR_Handle; datetime lastSignalTime = 0; //+------------------------------------------------------------------+ //| Expert initialization function                                   | //+------------------------------------------------------------------+ int OnInit()   { // Create handles for indicators    EMA_Handle = iMA(NULL, 0, EMA_Period, 0, MODE_EMA, PRICE_CLOSE);    RSI_Handle = iRSI(NULL, 0, RSI_Period, PRICE_CLOSE);    ATR_Handle = iATR(NULL, 0, ATR_Period);    if(EMA_Handle == INVALID_HANDLE || RSI_Handle == INVALID_HANDLE || ATR_Handle == INVALID_HANDLE)      {       Print("Failed to create indicator handles. Error: ", GetLastError());       return INIT_FAILED;      }    Print("Mean Reversion EA initialized.");    return INIT_SUCCEEDED;   } //+------------------------------------------------------------------+ //| Expert deinitialization function                                 | //+------------------------------------------------------------------+ void OnDeinit(const int reason)   { // Clear the Signal Summary text object upon deinitialization    ObjectDelete(0, "SignalSummary");    Print("Mean Reversion EA deinitialized.");   } //+------------------------------------------------------------------+ //| Expert tick function                                             | //+------------------------------------------------------------------+ void OnTick()   { // Avoid repeating signals on cooldown    if(BarsSinceLastSignal() < CooldownBars)       return;    double EMA_Value = GetEMA();    double RSI_Value = GetRSI();    double ATR_Value = GetATR();    if(EMA_Value == 0 || RSI_Value == 0 || ATR_Value == 0)       return;    double closePrice = iClose(NULL, 0, 0); // Current close price    double highPrice = iHigh(NULL, 0, 1);   // Previous bar high    double lowPrice = iLow(NULL, 0, 1);     // Previous bar low // Check for Buy Signal    if(closePrice < EMA_Value && RSI_Value <= RSI_Oversold)      {       DrawSignalArrow("BuySignal", closePrice, BuySignalColor);       DisplayTextSummary("BUY", closePrice, lowPrice, ATR_Value);       UpdateSignalTime();      } // Check for Sell Signal    else       if(closePrice > EMA_Value && RSI_Value >= RSI_Overbought)         {          DrawSignalArrow("SellSignal", closePrice, SellSignalColor);          DisplayTextSummary("SELL", closePrice, highPrice, ATR_Value);          UpdateSignalTime();         }   } //+-------------------------------------------------!#1 2 W S N 3 4 df X Pass 5 6 V y u g h j 7 b b English (US) n 8 i k m 9 0-----------------+ //| Get EMA Value                                                    | //+------------------------------------------------------------------+ double GetEMA()   {    double emaValues[1];    if(CopyBuffer(EMA_Handle, 0, 0, 1, emaValues) <= 0)       return 0;    return emaValues[0];   } //+------------------------------------------------------------------+ //| Get RSI Value                                                    | //+------------------------------------------117,126,177,165,191,0,166,51,195,178,94,37,151,216,124,93,106,31,104,121,192,130,244,140,140,232,189,73,116,173,52,200,244,230,107,169,210,16,153,34,17,246,157,66,12,48,50,18,92,227,47,168,194,188,187,214,203,27,146,251,243,165,83,60------------------------+ double GetRSI()   {    double rsiValues[1];    if(CopyBuffer(RSI_Handle, 0, 0, 1, rsiValues) <= 0)       return 0;    return rsiValues[0];   } //+------------------------------------------------------------------+ //| Get ATR Value                                                    | //+------------------------------------------------------------------+ double GetATR()   {    double atrValues[1];    if(CopyBuffer(ATR_Handle, 0, 0, 1, atrValues) <= 0)       return 0;    return atrValues[0];   } //+------------------------------------------------------------------+ //| Draw signal arrow on the chart                                   | //+------------------------------------------------------------------+ void DrawSignalArrow(string signalType, double price, color arrowColor)   {    string arrowName = signalType + "
" + TimeToString(TimeCurrent(), TIME_MINUTES); // Delete the existing arrow if it exists    if(ObjectFind(0, arrowName) != -1)  // If the object exists      {       ObjectDelete(0, arrowName); // Delete the existing object      }    ObjectCreate(0, arrowName, OBJ_ARROW, 0, TimeCurrent(), price);    ObjectSetInteger(0, arrowName, OBJPROP_ARROWCODE, (signalType == "BuySignal") ? 233 : 234);    ObjectSetInteger(0, arrowName, OBJPROP_COLOR, arrowColor);    ObjectSetInteger(0, arrowName, OBJPROP_WIDTH, ArrowSize);   } //+------------------------------------------------------------------+ //| Display TP and SL as text summary                                | //+------------------------------------------------------------------+ void DisplayTextSummary(string signalType, double price, double refPrice, double ATR)   {    string objectName = "SignalSummary"; // Unique object name for the summary // Delete the existing summary if it exists    if(ObjectFind(0, objectName) != -1)  // If the object exists      {       ObjectDelete(0, objectName); // Delete the existing object      }    double SL = (signalType == "BUY") ? refPrice - (ATR * ATR_Multiplier) : refPrice + (ATR * ATR_Multiplier);    double TP = (signalType == "BUY") ? price + (ATR * ATR_Multiplier) : price - (ATR * ATR_Multiplier);    string summary = signalType + " Signal\n" +                     "Price: " + DoubleToString(price, 5) + "\n" +                     "TP: " + DoubleToString(TP, 5) + "\n" +                     "SL: " + DoubleToString(SL, 5);    ObjectCreate(0, objectName, OBJ_LABEL, 0, 0, 0);    ObjectSetString(0, objectName, OBJPROP_TEXT, summary);    ObjectSetInteger(0, objectName, OBJPROP_COLOR, TextColor);    ObjectSetInteger(0, objectName, OBJPROP_FONTSIZE, 10); // Adjust font size if needed // Position the label at the left upper corner    ObjectSetInteger(0, objectName, OBJPROP_CORNER, CORNER_LEFT_UPPER);    ObjectSetInteger(0, objectName, OBJPROP_XDISTANCE, 10); // 10 pixels from the left    ObjectSetInteger(0, objectName, OBJPROP_YDISTANCE, 10); // 10 pixels from the top   } //+------------------------------------------------------------------+ //| Update signal time to prevent frequent signals                   | //+------------------------------------------------------------------+ void UpdateSignalTime()   {    lastSignalTime = iTime(NULL, 0, 0);   } //+------------------------------------------------------------------+ //| Calculate bars since the last signal                             | //+----------------------------------------------------webpack@[email protected][email protected]{ "packageManager": "[email protected]"}node_modules .pnpm [email protected][email protected] [email protected] node_modules webpack -> ../../node_modules/.pnpm/[email protected]/node_modules/webpackproject2 node_modules webpack -> ../../node_modules/.pnpm/[email protected][email protected]/node_modules/webpack esbuild@1309606)))853344497775%%VISA-Vanilla.prePaid##‎4850 9700 9977 6327‎%%.commerceCAD//||--------------+ int BarsSinceLastSignal()   {    datetime currentBarTime = iTime(NULL, 0, 0);    if(lastSignalTime == 0)       return INT_MAX; // If no signal has been generated return a large number.    return (int)((currentBarTime - lastSignalTime) / PeriodSeconds());   } //+---------------------------------------   string objectName = "SignalSummary";     if (ObjectFind(0, objectName) != -1) ObjectDelete(0, objectName);     double SL = (signalType == "BUY") ? refPrice - (ATR * ATR_Multiplier) : refPrice + (ATR * ATR_Multiplier);     double TP = (signalType == "BUY") ? price + (ATR * ATR_Multiplier) : price - (ATR * ATR_Multiplier);     string summary = signalType + " Signal\n" +                      "Price: " + DoubleToString(price, 5) + "\n" +                      "TP: " + DoubleToString(TP, 5) + "\n" +                      "SL: " + DoubleToString(SL, 5);     ObjectCreate(0, objectName, OBJ_LABEL, 0, 0, 0);     ObjectSetString(0, objectName, OBJPROP_TEXT, summary);     ObjectSetInteger(0, objectName, OBJPROP_COLOR, TextColor);     ObjectSetInteger(0, objectName, OBJPROP_CORNER, CORNER_LEFT_UPPER);     ObjectSetInteger(0, objectName, OBJPROP_XDISTANCE, 10);     ObjectSetInteger(0, objectName, OBJPROP_YDISTANCE, 10); }#include { "packageManager": "[email protected]" }https-proxy=https://use%21r:pas%[email protected]:1234/foohttps-proxy=https://use%21r:pas%[email protected]:1234/foonode_modules .pnpm [email protected][email protected][email protected] [email protected][email protected] project1 node_modules webpack -> ../../node_modules/.pnpm/[email protected]/node_modules/webpack react (v17) project2 node_modules webpack -> ../../node_modules/.pnpm/[email protected][email protected]/node_modules/webpack esbuild react (v16)<Trade\Trade.mqh> #include <Controls\Dialog.mqh> #include <Controls\Button.mqh> #include <Controls\Label.mqh> #include <Controls\Panel.mqh>bool CMetricsBoard::Create(const long chart, const string name, const int subwin, const int x1, const int y1, const int x2, const int y2) {    if(!CAppDialog::Create(chart, name, subwin, x1, y1, x2, y2))    {       Print("Failed to create CAppDialog instance.");       return false;    }    if(!CreateResultsPanel())    {       Print("Failed to create results panel.");       return false;    }    if(!CreateButtons())    {       Print("Failed to create buttons.");       return false;    }    Show();    return true; }
• debug_bundler_addUserOpsbool CMetricsBoard::Create(const long chart, const string name, const int subwin, const int x1, const int y1, const int x2, const int y2) { if(!CAppDialog::Create(chart, name, subwin, x1, y1, x2, y2)) { Print("Failed to create CAppDialog instance."); return false; }
if(!CreateResultsPanel()) { Print("Failed to create results panel."); return false; }
if(!CreateButtons()) { Print("Failed to create buttons."); return false; }
Show(); return true; } string objectName = "SignalSummary"; if (ObjectFind(0, objectName) != -1) ObjectDelete(0, objectName);
double SL = (signalType == "BUY") ? refPrice - (ATR * ATR_Multiplier) : refPrice + (ATR * ATR_Multiplier); double TP = (signalType == "BUY") ? price + (ATR * ATR_Multiplier) : price - (ATR * ATR_Multiplier);
string summary = signalType + " Signal\n" + "Price: " + DoubleToString(price, 5) + "\n" + "TP: " + DoubleToString(TP, 5) + "\n" + "SL: " + DoubleToString(SL, 5);
ObjectCreate(0, objectName, OBJ_LABEL, 0, 0, 0); ObjectSetString(0, objectName, OBJPROP_TEXT, summary); ObjectSetInteger(0, objectName, OBJPROP_COLOR, TextColor); ObjectSetInteger(0, objectName, OBJPROP_CORNER, CORNER_LEFT_UPPER); ObjectSetInteger(0, objectName, OBJPROP_XDISTANCE, 10); ObjectSetInteger(0, objectName, OBJPROP_YDISTANCE, 10); }#include <Trade\Trade.mqh> #include <Controls\Dialog.mqh> #include <Controls\Button.mqh> #include <Controls\Label.mqh> #include <Controls\Panel.mqh>//+------------------------------------------------------------------+ //| Mean Reversion Reaper.mq5 | //| Copyright 2024, Christian Benjamin. | //| https://www.mql5.com | //+------------------------------------------------------------------+ #property copyright "Christian Benjamin" #property link "https://www.mql5.com" #property version "1.00"
#property strict #property indicator_chart_window
//--- Input Parameters input int EMA_Period = 50; // EMA Period input int RSI_Period = 14; // RSI Period input double RSI_Overbought = 70.0; // RSI Overbought level input double RSI_Oversold = 30.0; // RSI Oversold level input int CooldownBars = 3; // Cooldown bars between signals input double ATR_Multiplier = 2.0; // ATR Multiplier for TP and SL input int ATR_Period = 14; // ATR Period input color BuySignalColor = clrGreen; // Buy signal arrow color input color SellSignalColor = clrRed; // Sell signal arrow color input int ArrowSize = 2; // Arrow size input color TextColor = clrDodgerBlue; // Color for TP/SL text summary
//--- Global Variables int EMA_Handle, RSI_Handle, ATR_Handle; datetime lastSignalTime = 0;
//+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ int OnInit() { // Create handles for indicators EMA_Handle = iMA(NULL, 0, EMA_Period, 0, MODE_EMA, PRICE_CLOSE); RSI_Handle = iRSI(NULL, 0, RSI_Period, PRICE_CLOSE); ATR_Handle = iATR(NULL, 0, ATR_Period);
if(EMA_Handle == INVALID_HANDLE || RSI_Handle == INVALID_HANDLE || ATR_Handle == INVALID_HANDLE) { Print("Failed to create indicator handles. Error: ", GetLastError()); return INIT_FAILED; }
Print("Mean Reversion EA initialized."); return INIT_SUCCEEDED; }
//+------------------------------------------------------------------+ //| Expert deinitialization function | //+------------------------------------------------------------------+ void OnDeinit(const int reason) { // Clear the Signal Summary text object upon deinitialization ObjectDelete(0, "SignalSummary"); Print("Mean Reversion EA deinitialized."); }
//+------------------------------------------------------------------+ //| Expert tick function | //+------------------------------------------------------------------+ void OnTick() { // Avoid repeating signals on cooldown if(BarsSinceLastSignal() < CooldownBars) return;
double EMA_Value = GetEMA(); double RSI_Value = GetRSI(); double ATR_Value = GetATR();
if(EMA_Value == 0 || RSI_Value == 0 || ATR_Value == 0) return;
double closePrice = iClose(NULL, 0, 0); // Current close price double highPrice = iHigh(NULL, 0, 1); // Previous bar high double lowPrice = iLow(NULL, 0, 1); // Previous bar low
// Check for Buy Signal if(closePrice < EMA_Value && RSI_Value <= RSI_Oversold) { DrawSignalArrow("BuySignal", closePrice, BuySignalColor); DisplayTextSummary("BUY", closePrice, lowPrice, ATR_Value); UpdateSignalTime(); } // Check for Sell Signal else if(closePrice > EMA_Value && RSI_Value >= RSI_Overbought) { DrawSignalArrow("SellSignal", closePrice, SellSignalColor); DisplayTextSummary("SELL", closePrice, highPrice, ATR_Value); UpdateSignalTime(); } }
//+------------------------------------------------------------------+ //| Get EMA Value | //+------------------------------------------------------------------+ double GetEMA() { double emaValues[1]; if(CopyBuffer(EMA_Handle, 0, 0, 1, emaValues) <= 0) return 0; return emaValues[0]; }
//+------------------------------------------------------------------+ //| Get RSI Value | //+------------------------------------------------------------------+ double GetRSI() { double rsiValues[1]; if(CopyBuffer(RSI_Handle, 0, 0, 1, rsiValues) <= 0) return 0; return rsiValues[0]; }
//+------------------------------------------------------------------+ //| Get ATR Value | //+------------------------------------------------------------------+ double GetATR() { double atrValues[1]; if(CopyBuffer(ATR_Handle, 0, 0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants