読み取り専用

フォーラムは現在、読み取り専用のアーカイブとなっています。.

バグ報告やプラットフォームに関する質問はこちら → [email protected]

私たちのコミュニティはDiscordとYouTubeで活動しています。ぜひ参加してください!

ご参加ください Discord YouTube

AlgoWizardでの関数の作成

3件の返信

意図的な取引

購読者、bbp_participant、顧客、コミュニティ、sq-ultimate、7件の返信。.

プロフィールを表示

1年前 #288569

こんにちは,

I’m an experienced MQL5 developer and am trying to code our EA into SQX for back testing. We already successfully coded our indicators in .java using code editor, but I’m not seeing an option to create a strategy in Code Editor. Am I seeing this correctly? We’re not allowed to code strategies in Code Editor?

If so, how would I code in my custom functions using AlgoWizard as I’m not seeing the options I need in the fixed dropdowns? I tried the “Custom Functions” where I put a function in the .mq5 in “C:\StrategyQuantX138\user\extend\Code\MetaTrader5\CustomFunctions” but it did not seem to recognize this for back testing.

For example, one of the more simplistic functions we have is to assign the Average Price for Buys into a variable, how would I do this with AlgoWizard? or is there a way to code a strategy in Code Editor similar to how we code indicators in .java?

Below is a sample function I’d like to code.

Thank you for your help in advance.

[code]double Average_Price_BUY(ulong magicNumber,string symbol,int s){

double Total_Price = 0;
double Total_Size = 0;
double bAverage_Price;

for(int i = PositionsTotal() – 1; i >= 0; i–){
string CurrencyPair = PositionGetSymbol(i);
double PositionOpenPrice = PositionGetDouble(POSITION_PRICE_OPEN);
double PositionSize = PositionGetDouble(POSITION_VOLUME);
long PositionDirection = PositionGetInteger(POSITION_TYPE);
long PositionMagicNumber = PositionGetInteger(POSITION_MAGIC);

if (symbol == CurrencyPair && PositionDirection == POSITION_TYPE_BUY && PositionMagicNumber == magicNumber){
Total_Size += PositionSize;
Total_Price += PositionOpenPrice * PositionSize;
}
}

if (Total_Size != 0) {
bAverage_Price = Total_Price / Total_Size;
} else {

bAverage_Price = 0.0;
}

 

if(inpCommissionAccount==false){return bAverage_Price;}
else{return bAverage_Price+(sym[s].CommPointsToAdd*SymbolPoint(symbol));}
}[/code]

 

0

Tomas Matejka

管理者、sq-ultimate、2件の返信.

プロフィールを表示

1年前 #288574

こんにちは、,

that is correct. You cannot use CodeEditor to create strategies directly.

CustomFunctions can only used in sim / real not in backtesting. You cannot simply get the average price. In MT4/5 hedging mode each position is being treated as independent. You cannot as well directly reference “position average price”

0

意図的な取引

購読者、bbp_participant、顧客、コミュニティ、sq-ultimate、7件の返信。.

プロフィールを表示

1年前 #288582

Okay thank you for your answer.

Is there any way to write anything custom in AlgoWizard or are we limited to the fixed dropdowns?

1

Bartosz

購読者, bbp_participant, 顧客, コミュニティ, sq-ultimate, 1件の返信.

プロフィールを表示

1年前 #289168

1. I’m also interested in using CUST Custom Function. Description says we can use it to put our custom MQL code, but doesn’t mention we can’t use it in the retester etc. So, what’s its intended usage?

0

3件の返信を表示中 - 1 - 3件目 (全3件中)